@openclaw/lobster 2026.9.5 → 2026.9.6

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 (100) hide show
  1. package/node_modules/@clawdbot/lobster/README.md +20 -133
  2. package/node_modules/@clawdbot/lobster/VISION.md +15 -238
  3. package/node_modules/@clawdbot/lobster/bin/clawd.invoke.js +2 -21
  4. package/node_modules/@clawdbot/lobster/bin/invoke.js +19 -0
  5. package/node_modules/@clawdbot/lobster/bin/lobster.js +2 -21
  6. package/node_modules/@clawdbot/lobster/bin/openclaw.invoke.js +2 -24
  7. package/node_modules/@clawdbot/lobster/dist/src/cli.js +32 -48
  8. package/node_modules/@clawdbot/lobster/dist/src/cli.js.map +1 -1
  9. package/node_modules/@clawdbot/lobster/dist/src/command_tokens.js +81 -0
  10. package/node_modules/@clawdbot/lobster/dist/src/command_tokens.js.map +1 -0
  11. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/dedupe.js +1 -12
  12. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/dedupe.js.map +1 -1
  13. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/group_by.js +2 -14
  14. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/group_by.js.map +1 -1
  15. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/llm_invoke.js +1 -337
  16. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/llm_invoke.js.map +1 -1
  17. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/map.js +2 -13
  18. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/map.js.map +1 -1
  19. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/sort.js +4 -21
  20. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/sort.js.map +1 -1
  21. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/state.js +1 -1
  22. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/state.js.map +1 -1
  23. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/template.js +2 -13
  24. package/node_modules/@clawdbot/lobster/dist/src/commands/stdlib/template.js.map +1 -1
  25. package/node_modules/@clawdbot/lobster/dist/src/commands/workflows/workflows_run.js +0 -18
  26. package/node_modules/@clawdbot/lobster/dist/src/commands/workflows/workflows_run.js.map +1 -1
  27. package/node_modules/@clawdbot/lobster/dist/src/core/llm_accounting.js +304 -0
  28. package/node_modules/@clawdbot/lobster/dist/src/core/llm_accounting.js.map +1 -0
  29. package/node_modules/@clawdbot/lobster/dist/src/core/value_path.js +11 -0
  30. package/node_modules/@clawdbot/lobster/dist/src/core/value_path.js.map +1 -0
  31. package/node_modules/@clawdbot/lobster/dist/src/parser.js +2 -67
  32. package/node_modules/@clawdbot/lobster/dist/src/parser.js.map +1 -1
  33. package/node_modules/@clawdbot/lobster/dist/src/recipes/github/index.js +1 -1
  34. package/node_modules/@clawdbot/lobster/dist/src/recipes/github/pr-monitor.js +5 -64
  35. package/node_modules/@clawdbot/lobster/dist/src/recipes/github/pr-monitor.js.map +1 -1
  36. package/node_modules/@clawdbot/lobster/dist/src/recipes/github/read_pr.js +45 -0
  37. package/node_modules/@clawdbot/lobster/dist/src/recipes/github/read_pr.js.map +1 -0
  38. package/node_modules/@clawdbot/lobster/dist/src/recipes/github/snapshot.js +45 -0
  39. package/node_modules/@clawdbot/lobster/dist/src/recipes/github/snapshot.js.map +1 -0
  40. package/node_modules/@clawdbot/lobster/dist/src/recipes/github/stages/pr-view.js +9 -47
  41. package/node_modules/@clawdbot/lobster/dist/src/recipes/github/stages/pr-view.js.map +1 -1
  42. package/node_modules/@clawdbot/lobster/dist/src/sdk/Lobster.js +18 -135
  43. package/node_modules/@clawdbot/lobster/dist/src/sdk/Lobster.js.map +1 -1
  44. package/node_modules/@clawdbot/lobster/dist/src/sdk/index.js +1 -1
  45. package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/approve.js +1 -2
  46. package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/approve.js.map +1 -1
  47. package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/diff.js +2 -8
  48. package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/diff.js.map +1 -1
  49. package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/exec.js +15 -81
  50. package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/exec.js.map +1 -1
  51. package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/state.js +3 -9
  52. package/node_modules/@clawdbot/lobster/dist/src/sdk/primitives/state.js.map +1 -1
  53. package/node_modules/@clawdbot/lobster/dist/src/sdk/runtime.js +0 -12
  54. package/node_modules/@clawdbot/lobster/dist/src/sdk/runtime.js.map +1 -1
  55. package/node_modules/@clawdbot/lobster/dist/src/sdk/state_env.js +6 -0
  56. package/node_modules/@clawdbot/lobster/dist/src/sdk/state_env.js.map +1 -0
  57. package/node_modules/@clawdbot/lobster/dist/src/state/atomic_file.js +192 -0
  58. package/node_modules/@clawdbot/lobster/dist/src/state/atomic_file.js.map +1 -0
  59. package/node_modules/@clawdbot/lobster/dist/src/state/store.js +2 -188
  60. package/node_modules/@clawdbot/lobster/dist/src/state/store.js.map +1 -1
  61. package/node_modules/@clawdbot/lobster/dist/src/workflows/dry_run.js +262 -0
  62. package/node_modules/@clawdbot/lobster/dist/src/workflows/dry_run.js.map +1 -0
  63. package/node_modules/@clawdbot/lobster/dist/src/workflows/expressions.js +345 -0
  64. package/node_modules/@clawdbot/lobster/dist/src/workflows/expressions.js.map +1 -0
  65. package/node_modules/@clawdbot/lobster/dist/src/workflows/file.js +21 -1036
  66. package/node_modules/@clawdbot/lobster/dist/src/workflows/file.js.map +1 -1
  67. package/node_modules/@clawdbot/lobster/dist/src/workflows/github_pr_monitor.js +8 -77
  68. package/node_modules/@clawdbot/lobster/dist/src/workflows/github_pr_monitor.js.map +1 -1
  69. package/node_modules/@clawdbot/lobster/dist/src/workflows/graph.js +1 -7
  70. package/node_modules/@clawdbot/lobster/dist/src/workflows/graph.js.map +1 -1
  71. package/node_modules/@clawdbot/lobster/dist/src/workflows/load.js +347 -0
  72. package/node_modules/@clawdbot/lobster/dist/src/workflows/load.js.map +1 -0
  73. package/node_modules/@clawdbot/lobster/dist/src/workflows/types.js +2 -0
  74. package/node_modules/@clawdbot/lobster/dist/src/workflows/types.js.map +1 -0
  75. package/node_modules/@clawdbot/lobster/dist/src/workflows/values.js +93 -0
  76. package/node_modules/@clawdbot/lobster/dist/src/workflows/values.js.map +1 -0
  77. package/node_modules/@clawdbot/lobster/dist/test/cancellation.test.js +1 -0
  78. package/node_modules/@clawdbot/lobster/dist/test/cancellation.test.js.map +1 -1
  79. package/node_modules/@clawdbot/lobster/dist/test/cli_run_errors.test.js +53 -0
  80. package/node_modules/@clawdbot/lobster/dist/test/cli_run_errors.test.js.map +1 -0
  81. package/node_modules/@clawdbot/lobster/dist/test/command_arguments.test.js +82 -0
  82. package/node_modules/@clawdbot/lobster/dist/test/command_arguments.test.js.map +1 -0
  83. package/node_modules/@clawdbot/lobster/dist/test/cost_tracker.test.js +49 -19
  84. package/node_modules/@clawdbot/lobster/dist/test/cost_tracker.test.js.map +1 -1
  85. package/node_modules/@clawdbot/lobster/dist/test/helpers/node_shell_fixture.js +17 -0
  86. package/node_modules/@clawdbot/lobster/dist/test/helpers/node_shell_fixture.js.map +1 -0
  87. package/node_modules/@clawdbot/lobster/dist/test/llm_invoke.test.js +2 -0
  88. package/node_modules/@clawdbot/lobster/dist/test/llm_invoke.test.js.map +1 -1
  89. package/node_modules/@clawdbot/lobster/dist/test/pipeline_resume_state.test.js +65 -0
  90. package/node_modules/@clawdbot/lobster/dist/test/pipeline_resume_state.test.js.map +1 -0
  91. package/node_modules/@clawdbot/lobster/dist/test/process_output_limit.test.js +5 -3
  92. package/node_modules/@clawdbot/lobster/dist/test/process_output_limit.test.js.map +1 -1
  93. package/node_modules/@clawdbot/lobster/dist/test/sdk_exec.test.js +72 -25
  94. package/node_modules/@clawdbot/lobster/dist/test/sdk_exec.test.js.map +1 -1
  95. package/node_modules/@clawdbot/lobster/dist/test/workflow_graph.test.js +1 -1
  96. package/node_modules/@clawdbot/lobster/dist/test/workflow_graph.test.js.map +1 -1
  97. package/node_modules/@clawdbot/lobster/package.json +6 -8
  98. package/package.json +5 -5
  99. package/node_modules/@clawdbot/lobster/dist/src/sdk/token.js +0 -9
  100. package/node_modules/@clawdbot/lobster/dist/src/sdk/token.js.map +0 -1
@@ -2,139 +2,20 @@
2
2
 
3
3
  ![Lobster banner](docs/assets/readme-banner.jpg)
4
4
 
5
- An OpenClaw-native workflow shell: typed (JSON-first) pipelines, jobs, and approval gates.
5
+ An OpenClaw-native workflow shell: typed (JSON-first) pipelines and approval gates.
6
6
 
7
+ ## Example
7
8
 
8
- ## Example of Lobster at work
9
- OpenClaw (or any other AI agent) can use `lobster` as a workflow engine and avoid re-planning every step — saving tokens while improving determinism and resumability.
9
+ A named workflow fetches a pull request with `gh`, compares it with the saved snapshot, and returns a notification only when it changes:
10
10
 
11
- ### Watching a PR that hasn't had changes
12
- ```
13
- node bin/lobster.js "workflows.run --name github.pr.monitor --args-json '{\"repo\":\"openclaw/openclaw\",\"pr\":1152}'"
14
- [
15
- {
16
- "kind": "github.pr.monitor",
17
- "repo": "openclaw/openclaw",
18
- "prNumber": 1152,
19
- "key": "github.pr:openclaw/openclaw#1152",
20
- "changed": false,
21
- "summary": {
22
- "changedFields": [],
23
- "changes": {}
24
- },
25
- "prSnapshot": {
26
- "author": {
27
- "id": "MDQ6VXNlcjE0MzY4NTM=",
28
- "is_bot": false,
29
- "login": "vignesh07",
30
- "name": "Vignesh"
31
- },
32
- "baseRefName": "main",
33
- "headRefName": "feat/lobster-plugin",
34
- "isDraft": false,
35
- "mergeable": "MERGEABLE",
36
- "number": 1152,
37
- "reviewDecision": "",
38
- "state": "OPEN",
39
- "title": "feat: Add optional lobster plugin tool (typed workflows, approvals/resume)",
40
- "updatedAt": "2026-01-18T20:16:56Z",
41
- "url": "https://github.com/openclaw/openclaw/pull/1152"
42
- }
43
- }
44
- ]
11
+ ```bash
12
+ node bin/lobster.js run --mode tool "workflows.run --name github.pr.monitor.notify --args-json '{\"repo\":\"openclaw/lobster\",\"pr\":167}'"
45
13
  ```
46
- ### And a PR that has a state change (in this case an approved PR)
47
14
 
48
- ```
49
- node bin/lobster.js "workflows.run --name github.pr.monitor --args-json '{\"repo\":\"openclaw/openclaw\",\"pr\":1200}'"
50
- [
51
- {
52
- "kind": "github.pr.monitor",
53
- "repo": "openclaw/openclaw",
54
- "prNumber": 1200,
55
- "key": "github.pr:openclaw/openclaw#1200",
56
- "changed": true,
57
- "summary": {
58
- "changedFields": [
59
- "number",
60
- "title",
61
- "url",
62
- "state",
63
- "isDraft",
64
- "mergeable",
65
- "reviewDecision",
66
- "updatedAt",
67
- "baseRefName",
68
- "headRefName"
69
- ],
70
- "changes": {
71
- "number": {
72
- "from": null,
73
- "to": 1200
74
- },
75
- "title": {
76
- "from": null,
77
- "to": "feat(tui): add syntax highlighting for code blocks"
78
- },
79
- "url": {
80
- "from": null,
81
- "to": "https://github.com/openclaw/openclaw/pull/1200"
82
- },
83
- "state": {
84
- "from": null,
85
- "to": "MERGED"
86
- },
87
- "isDraft": {
88
- "from": null,
89
- "to": false
90
- },
91
- "mergeable": {
92
- "from": null,
93
- "to": "UNKNOWN"
94
- },
95
- "reviewDecision": {
96
- "from": null,
97
- "to": ""
98
- },
99
- "updatedAt": {
100
- "from": null,
101
- "to": "2026-01-19T05:06:09Z"
102
- },
103
- "baseRefName": {
104
- "from": null,
105
- "to": "main"
106
- },
107
- "headRefName": {
108
- "from": null,
109
- "to": "feat/tui-syntax-highlighting"
110
- }
111
- }
112
- },
113
- "prSnapshot": {
114
- "author": {
115
- "id": "MDQ6VXNlcjE0MzY4NTM=",
116
- "is_bot": false,
117
- "login": "vignesh07",
118
- "name": "Vignesh"
119
- },
120
- "baseRefName": "main",
121
- "headRefName": "feat/tui-syntax-highlighting",
122
- "isDraft": false,
123
- "mergeable": "UNKNOWN",
124
- "number": 1200,
125
- "reviewDecision": "",
126
- "state": "MERGED",
127
- "title": "feat(tui): add syntax highlighting for code blocks",
128
- "updatedAt": "2026-01-19T05:06:09Z",
129
- "url": "https://github.com/openclaw/openclaw/pull/1200"
130
- }
131
- }
132
- ]
133
- ```
15
+ For repeatable automation, put shell commands, native pipeline steps, and explicit approval/input gates in a workflow file. OpenClaw presents the gate to the user and resumes with their decision.
134
16
 
135
17
  ## Goals
136
18
 
137
-
138
19
  - Typed pipelines (objects/arrays), not text pipes.
139
20
  - Local-first execution.
140
21
  - No new auth surface: Lobster must not own OAuth/tokens.
@@ -142,9 +23,10 @@ node bin/lobster.js "workflows.run --name github.pr.monitor --args-json '{\"repo
142
23
 
143
24
  ## Quick start
144
25
 
145
- From this folder:
26
+ Requires Node.js 22 or newer and the pnpm version pinned in `package.json`. From this folder:
146
27
 
147
- - `pnpm install`
28
+ - `pnpm install --frozen-lockfile`
29
+ - `pnpm build`
148
30
  - `pnpm test`
149
31
  - `pnpm lint`
150
32
  - `node ./bin/lobster.js --help`
@@ -154,7 +36,9 @@ From this folder:
154
36
  ### Notes
155
37
 
156
38
  - `pnpm test` runs `tsc` and then executes tests against `dist/`.
157
- - `bin/lobster.js` prefers the compiled entrypoint in `dist/` when present.
39
+ - `bin/lobster.js` runs the compiled entrypoint in `dist/`; build after changing source files.
40
+ Invalid explicit workflow file paths are reported as input errors (exit code 2). In `--mode tool`, these failures use the same JSON error envelope as other parsing errors.
41
+
158
42
  ## Process output limits
159
43
 
160
44
  Captured process stdout and stderr remain unlimited by default. Set
@@ -187,20 +71,16 @@ keep pipes open after overflow. Calls without an AbortSignal relay terminal
187
71
  interrupts to that group and retain the host's existing signal handlers or
188
72
  conventional interrupt exit status.
189
73
 
190
-
191
74
  ## Commands
192
75
 
193
76
  - `exec`: run OS commands
194
77
  - `exec --json <command...>`: parse subprocess stdout as JSON before the next stage
195
78
  - `exec --stdin raw|json|jsonl`: feed pipeline input into subprocess stdin
79
+ - Explicit quoted empty arguments are retained by both pipeline `exec` and SDK `exec`. Invocation shims preserve argument punctuation without shell expansion.
196
80
  - `where`, `pick`, `head`: data shaping
197
81
  - `json`, `table`: renderers
198
82
  - `approve`: approval gate (TTY prompt or `--emit` for OpenClaw integration)
199
83
 
200
- ## Next steps
201
-
202
- - OpenClaw integration: ship as an optional OpenClaw plugin tool.
203
-
204
84
  ## SDK cancellation
205
85
 
206
86
  Pass an `AbortSignal` to `new Lobster({ signal })` to cancel SDK `exec()` stages,
@@ -303,6 +183,7 @@ Commands are re-run on resume, so they must be idempotent until `requestInput` r
303
183
  Use `lobster graph` to inspect workflow structure before execution.
304
184
 
305
185
  ```bash
186
+ lobster graph --help
306
187
  lobster graph --file path/to/workflow.lobster
307
188
  lobster graph --file path/to/workflow.lobster --format mermaid
308
189
  lobster graph --file path/to/workflow.lobster --format dot
@@ -462,3 +343,9 @@ The limit counts bytes read from the response stream, including decompressed
462
343
  content. A declared Content-Length over the limit is also rejected immediately.
463
344
  Tool dispatch remains non-retryable after an overflow, as with other
464
345
  post-dispatch errors; `llm.invoke` retains its existing retry policy.
346
+
347
+ ## Development
348
+
349
+ The source is one TypeScript package. `src/core` contains the embeddable tool API, cost tracking, and LLM accounting; `src/sdk` provides pipeline composition; `src/commands` holds the command registry and standard library. Workflow loading, expressions, dry-run rendering, and execution live under `src/workflows`. `src/state` owns atomic file persistence, locks, and resume capabilities. GitHub SDK recipes and built-in workflows share transport and snapshot helpers.
350
+
351
+ Run `pnpm test`, `pnpm typecheck`, and `pnpm lint` before submitting changes. Tests compile into `dist/test` and use Node's test runner; platform-specific process tests run only where their OS primitives exist. Dependencies observe the two-day release-age policy in `pnpm-workspace.yaml`.
@@ -1,249 +1,26 @@
1
- # Lobster: Vision & Value Proposition
1
+ # Lobster
2
2
 
3
- ## One-liner
3
+ Lobster executes repeatable workflows for OpenClaw. The host chooses a workflow, presents requests for approval or structured input, and resumes with the user's decision. Lobster owns deterministic execution and saved continuation state.
4
4
 
5
- **Lobster is safe automation for OpenClaw — workflows that ask before acting.**
5
+ ## Responsibilities
6
6
 
7
- ---
7
+ - Compose JSON pipelines and workflow files with shell commands, native stages, conditions, loops, and parallel branches.
8
+ - Pause at explicit approval or input gates and return a continuation token.
9
+ - Persist snapshots and resume state locally, with atomic publication and cancellation-aware cleanup.
10
+ - Report estimated LLM spend and enforce configured workflow cost limits.
8
11
 
9
- ## What is Lobster?
12
+ Approvals are explicit workflow steps. They protect actions placed after the gate; they are not an automatic sandbox for arbitrary shell commands or tool calls. Workflow authors must put gates before actions that require user consent.
10
13
 
11
- Lobster is a workflow runtime for OpenClaw. It lets you define multi-step automations that:
14
+ ## Host boundary
12
15
 
13
- - Run deterministically (no LLM re-planning each step)
14
- - Halt at checkpoints and ask for approval before side effects
15
- - Resume exactly where they left off
16
- - Remember what they've already processed
16
+ OpenClaw owns intent, user interaction, authentication, provider integration, and tool execution policy. Lobster orchestrates those capabilities. It does not own OAuth or a credential store.
17
17
 
18
- Think of it as **IFTTT/Zapier for OpenClaw, but with human checkpoints**.
18
+ The intended inference direction is gateway-only, as recorded in [#135](https://github.com/openclaw/lobster/issues/135). Current releases still support OpenClaw, Pi, HTTP, and injected adapters. The gateway contract and compatibility window must be settled before those configurations are retired; no new vendor adapters belong in the engine.
19
19
 
20
- ---
20
+ Lobster currently renders static workflow graphs in Mermaid, DOT, and ASCII. A live dashboard and retained run history are separate product decisions, tracked in [#163](https://github.com/openclaw/lobster/issues/163).
21
21
 
22
- ## The Problem Lobster Solves
22
+ ## Use
23
23
 
24
- ### Today's workflow in OpenClaw
24
+ Use a direct tool call for a one-off action. Use Lobster when a sequence is repeatable, needs saved state, or includes a human checkpoint. Deterministic steps avoid repeatedly asking a model to reconstruct the same execution sequence; model calls remain explicit stages where judgment is needed.
25
25
 
26
- ```
27
- User: "Check my email, draft replies to anything urgent, and send them"
28
-
29
- What happens:
30
- 1. LLM plans: "I should search emails first"
31
- 2. Tool call: gmail.search
32
- 3. LLM interprets results, plans next step
33
- 4. Tool call: gmail.get (for each email)
34
- 5. LLM drafts replies
35
- 6. LLM decides to send
36
- 7. Tool call: gmail.send
37
- ... repeat for each email
38
- ```
39
-
40
- **Problems:**
41
- - Many tool calls = many tokens = expensive
42
- - LLM decides when to send = risky (what if it misunderstands?)
43
- - No memory = tomorrow it re-triages the same emails
44
- - Not repeatable = you can't save this as an automation
45
-
46
- ### With Lobster
47
-
48
- ```
49
- OpenClaw calls: lobster.run("email.triage")
50
-
51
- What happens:
52
- 1. Lobster fetches emails (deterministic)
53
- 2. Lobster classifies them (rule-based)
54
- 3. Lobster drafts replies (optional LLM step)
55
- 4. Lobster HALTS: "Send 3 drafts? [approve/reject]"
56
- 5. User approves
57
- 6. Lobster sends
58
-
59
- Tomorrow: Lobster remembers cursor, only processes new emails
60
- ```
61
-
62
- **One call. Deterministic. Safe. Stateful.**
63
-
64
- ---
65
-
66
- ## Why Lobster Makes OpenClaw Better
67
-
68
- | Without Lobster | With Lobster |
69
- |-----------------|--------------|
70
- | LLM orchestrates every step | Deterministic pipeline, LLM only for judgment |
71
- | 10+ tool calls per workflow | 1 call to Lobster |
72
- | "Don't send until I confirm" (hope it listens) | `approve` halts execution until explicit resume |
73
- | Forgets what it did yesterday | Stateful — tracks cursors/checkpoints |
74
- | Hard to share automations | Workflows are code — shareable, versionable |
75
-
76
- ### Token savings (real)
77
- A 10-step workflow today might cost 10 tool calls × LLM planning overhead.
78
- With Lobster: 1 tool call + compact structured output.
79
-
80
- ### Safety (the killer feature)
81
- The `approve` primitive isn't a prompt hint — it's a **hard stop**. The workflow literally cannot continue until you resume it. No "oops, it sent 50 emails."
82
-
83
- ### Memory (underrated)
84
- Workflows can persist state: "last processed email ID", "last PR SHA seen", etc. Tomorrow's run picks up where yesterday left off.
85
-
86
- ---
87
-
88
- ## How Lobster Fits with OpenClaw
89
-
90
- ```
91
- ┌─────────────────────────────────────────────────┐
92
- │ User │
93
- │ "triage my email daily" │
94
- └─────────────────────┬───────────────────────────┘
95
- │
96
- ▼
97
- ┌─────────────────────────────────────────────────┐
98
- │ OpenClaw │
99
- │ - Understands intent │
100
- │ - Chooses appropriate tool/workflow │
101
- │ - Presents results and approval prompts │
102
- └─────────────────────┬───────────────────────────┘
103
- │ lobster.run("email.triage")
104
- ▼
105
- ┌─────────────────────────────────────────────────┐
106
- │ Lobster │
107
- │ - Executes deterministic pipeline │
108
- │ - Calls OpenClaw tools (gmail, trello, etc) │
109
- │ - Halts at approval checkpoints │
110
- │ - Returns structured result + resume token │
111
- └─────────────────────────────────────────────────┘
112
- ```
113
-
114
- **Key insight:** Lobster doesn't replace OpenClaw. It's the execution layer that makes OpenClaw's automations safe and efficient.
115
-
116
- - **OpenClaw** = the brain (understands what you want)
117
- - **Lobster** = the hands (executes workflows safely)
118
- - **Tools/Skills** = the capabilities (gmail, trello, github, etc.)
119
-
120
- ---
121
-
122
- ## Who Should Use Lobster?
123
-
124
- ### Average OpenClaw users (invisible benefit)
125
- They don't need to know Lobster exists. They just notice:
126
- - "Set up daily email triage" works better
127
- - Automations ask before sending/posting
128
- - Things don't get re-processed every day
129
-
130
- ### Power users / tinkerers
131
- They can:
132
- - Customize workflows ("I want triage to also create Trello cards")
133
- - Write new workflows for their specific needs
134
- - Share workflows with the community
135
-
136
- ### The OpenClaw ecosystem
137
- - Workflow recipes become a new category of shareable assets
138
- - Skills stay simple (just expose APIs)
139
- - Lobster handles the orchestration layer
140
-
141
- ---
142
-
143
- ## Analogies That Work
144
-
145
- | If you know... | Lobster is like... |
146
- |----------------|-------------------|
147
- | IFTTT/Zapier | Multi-step version with approval checkpoints |
148
- | GitHub Actions | But for personal automation, not CI/CD |
149
- | AWS Step Functions | But local-first and human-in-the-loop |
150
- | Unix pipes | But for JSON objects, not text bytes |
151
- | Temporal | But 80/20 version for personal workflows |
152
-
153
- **Best analogy for most people:**
154
- > "Lobster is Zapier for OpenClaw, except it asks you before doing anything irreversible."
155
-
156
- ---
157
-
158
- ## Why Not Build This Into OpenClaw Core?
159
-
160
- It could be. But the plugin architecture is intentional:
161
-
162
- 1. **Core stays small** — OpenClaw is already complex
163
- 2. **Faster iteration** — Lobster can evolve without core releases
164
- 3. **Opt-in** — Not everyone needs workflow automation
165
- 4. **Community** — Easier to contribute workflows than core changes
166
- 5. **Ecosystem proof** — If plugins work for Lobster, they work for other capabilities
167
-
168
- OpenClaw explicitly provides a plugin boundary to enable this pattern. Lobster is the first proof that it works.
169
-
170
- ---
171
-
172
- ## Example Workflows
173
-
174
- ### Email triage (flagship)
175
- ```
176
- gog.gmail.search --query "newer_than:1d"
177
- | email.normalize
178
- | email.classify
179
- | where bucket==needs_reply
180
- | draft.reply
181
- | approve --prompt "Send N replies?"
182
- | gog.gmail.send
183
- ```
184
-
185
- ### PR monitor
186
- ```
187
- github.pr.get --repo org/repo --pr 123
188
- | diff.last
189
- | where changed==true
190
- | notify --channel telegram --message "PR updated: {summary}"
191
- ```
192
-
193
- ### Daily planning
194
- ```
195
- calendar.today
196
- | join tasks.today
197
- | prioritize
198
- | format.plan
199
- | approve --prompt "Post to #daily?"
200
- | message.send --channel slack --to "#daily"
201
- ```
202
-
203
- ### Inbox → Trello
204
- ```
205
- email.triage
206
- | where bucket==needs_action
207
- | to.trelloCard
208
- | approve --prompt "Create N cards?"
209
- | trello.card.create --list "Inbox"
210
- ```
211
-
212
- ---
213
-
214
- ## The USP (Unique Selling Proposition)
215
-
216
- **"Automations that ask before acting."**
217
-
218
- Other automation tools either:
219
- - Run blindly (IFTTT, Zapier) — scary for important actions
220
- - Require complex configuration for approvals
221
- - Don't integrate with your AI assistant
222
-
223
- Lobster is:
224
- - Native to OpenClaw (uses the same tools you already have)
225
- - Safe by default (approvals are a language primitive)
226
- - Invisible when you want (OpenClaw uses it automatically)
227
- - Customizable when you need (write your own workflows)
228
-
229
- ---
230
-
231
- ## What Lobster Is NOT
232
-
233
- - **Not a terminal replacement** — You don't switch your shell to Lobster
234
- - **Not a general programming language** — It's for workflows, not apps
235
- - **Not trying to replace OpenClaw** — It makes OpenClaw better
236
- - **Not managing your secrets** — OpenClaw handles auth, Lobster orchestrates
237
-
238
- ---
239
-
240
- ## Summary
241
-
242
- | Question | Answer |
243
- |----------|--------|
244
- | What is it? | Workflow runtime for OpenClaw |
245
- | One-liner? | Safe automation — workflows that ask before acting |
246
- | Why use it? | Cheaper, safer, stateful automations |
247
- | Who uses it? | Everyone (invisibly) or power users (directly) |
248
- | Why not in core? | Plugin architecture — core stays small, capabilities are extensions |
249
- | Best analogy? | Zapier for OpenClaw, but with approval checkpoints |
26
+ See the [README](README.md) for working commands, workflow syntax, cancellation, output limits, and SDK examples.
@@ -1,24 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { spawnSync } from "node:child_process";
4
- import { dirname, join } from "node:path";
5
- import { fileURLToPath } from "node:url";
3
+ import { runInvoke } from "./invoke.js";
6
4
 
7
- function shellQuote(arg) {
8
- if (/^[A-Za-z0-9_\-./:=@]+$/.test(arg)) return arg;
9
- return `'${String(arg).replace(/'/g, `'\\''`)}'`;
10
- }
11
-
12
- const argv = process.argv.slice(2);
13
- const pipeline = ["clawd.invoke", ...argv.map(shellQuote)].join(" ");
14
- const lobsterBin = join(dirname(fileURLToPath(import.meta.url)), "lobster.js");
15
-
16
- const res = spawnSync(process.execPath, [lobsterBin, pipeline], {
17
- stdio: "inherit",
18
- env: process.env,
19
- });
20
- if (res.error) {
21
- console.error(`clawd.invoke failed to spawn lobster: ${res.error.message}`);
22
- }
23
-
24
- process.exit(res.status ?? 1);
5
+ runInvoke("clawd.invoke");
@@ -0,0 +1,19 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { fileURLToPath } from "node:url";
3
+
4
+ function quotePipelineArgument(value) {
5
+ // Escape for Lobster's double-quoted token syntax, not for a shell.
6
+ return `"${String(value).replace(/[\\"$`]/g, "\\$&")}"`;
7
+ }
8
+
9
+ export function runInvoke(commandName) {
10
+ const pipeline = [commandName, ...process.argv.slice(2).map(quotePipelineArgument)].join(" ");
11
+ const result = spawnSync(
12
+ process.execPath,
13
+ [fileURLToPath(new URL("./lobster.js", import.meta.url)), pipeline],
14
+ { stdio: "inherit", env: process.env },
15
+ );
16
+ if (result.error)
17
+ console.error(`${commandName} failed to spawn lobster: ${result.error.message}`);
18
+ process.exit(result.status ?? 1);
19
+ }
@@ -1,24 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { existsSync } from "node:fs";
4
- import { fileURLToPath, pathToFileURL } from "node:url";
5
- import { dirname, join } from "node:path";
3
+ import { runCli } from "../dist/src/cli.js";
6
4
 
7
- const __filename = fileURLToPath(import.meta.url);
8
- const __dirname = dirname(__filename);
9
-
10
- async function load() {
11
- const distEntry = join(__dirname, "../dist/src/cli.js");
12
- if (existsSync(distEntry)) {
13
- return import(pathToFileURL(distEntry).href);
14
- }
15
- const srcEntry = join(__dirname, "../src/cli.js");
16
- return import(pathToFileURL(srcEntry).href);
17
- }
18
-
19
- const mod = await load();
20
- if (typeof mod.runCli !== "function") {
21
- throw new Error("lobster CLI entrypoint missing runCli()");
22
- }
23
-
24
- await mod.runCli(process.argv.slice(2));
5
+ await runCli(process.argv.slice(2));
@@ -1,27 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { spawnSync } from "node:child_process";
4
- import { dirname, join } from "node:path";
5
- import { fileURLToPath } from "node:url";
3
+ import { runInvoke } from "./invoke.js";
6
4
 
7
- function shellQuote(arg) {
8
- // Conservative POSIX-ish quoting for embedding argv into a single pipeline string.
9
- // Lobster's pipeline parser preserves quoted substrings.
10
- if (/^[A-Za-z0-9_\-./:=@]+$/.test(arg)) return arg;
11
- // single-quote, escaping embedded single quotes: ' -> '\''
12
- return `'${String(arg).replace(/'/g, `'\\''`)}'`;
13
- }
14
-
15
- const argv = process.argv.slice(2);
16
- const pipeline = ["openclaw.invoke", ...argv.map(shellQuote)].join(" ");
17
- const lobsterBin = join(dirname(fileURLToPath(import.meta.url)), "lobster.js");
18
-
19
- const res = spawnSync(process.execPath, [lobsterBin, pipeline], {
20
- stdio: "inherit",
21
- env: process.env,
22
- });
23
- if (res.error) {
24
- console.error(`openclaw.invoke failed to spawn lobster: ${res.error.message}`);
25
- }
26
-
27
- process.exit(res.status ?? 1);
5
+ runInvoke("openclaw.invoke");