home / skills / openclaw / skills / lobster

lobster skill

/skills/guwidoe/lobster

This skill runs deterministic, approval-gated pipelines for AI agents, enabling safe multi-step automation, monitoring, and data processing.

npx playbooks add skill openclaw/skills --skill lobster

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
4.0 KB
---
name: lobster
description: >
  Lobster workflow runtime for deterministic pipelines with approval gates.
  Use when: (1) Running multi-step automations that need human approval before side effects,
  (2) Monitoring PRs/issues for changes, (3) Processing data through typed JSON pipelines,
  (4) Email triage or batch operations, (5) Any workflow that should halt and ask before acting.
  Lobster saves tokens by running deterministic pipelines instead of re-planning each step.
---

# Lobster

> **Contribute:** Source code & PRs welcome at [github.com/guwidoe/lobster-skill](https://github.com/guwidoe/lobster-skill)

Workflow runtime for AI agents — typed pipelines with approval gates.

## CLI Location

```bash
# Set alias (adjust path to your install location)
LOBSTER="node /home/molt/clawd/tools/lobster/bin/lobster.js"

# Or install globally: npm install -g @clawdbot/lobster
# Then use: lobster '<pipeline>'
```

## Quick Reference

```bash
# Run pipeline (human mode - pretty output)
$LOBSTER '<pipeline>'

# Run pipeline (tool mode - JSON envelope for integration)
$LOBSTER run --mode tool '<pipeline>'

# Run workflow file
$LOBSTER run path/to/workflow.lobster

# Resume after approval
$LOBSTER resume --token "<token>" --approve yes|no

# List commands/workflows
$LOBSTER commands.list
$LOBSTER workflows.list
```

## Core Commands

| Command | Purpose |
|---------|---------|
| `exec --json --shell "cmd"` | Run shell, parse stdout as JSON |
| `where 'field=value'` | Filter objects |
| `pick field1,field2` | Project fields |
| `head --n 5` | Take first N items |
| `sort --key field --desc` | Sort items |
| `groupBy --key field` | Group by key |
| `dedupe --key field` | Remove duplicates |
| `map --wrap key` | Transform items |
| `template --text "{{field}}"` | Render templates |
| `approve --prompt "ok?"` | **Halt for approval** |
| `diff.last --key "mykey"` | Compare to last run (stateful) |
| `state.get key` / `state.set key` | Read/write persistent state |
| `json` / `table` | Render output |

## Built-in Workflows

```bash
# Monitor PR for changes (stateful - remembers last state)
$LOBSTER "workflows.run --name github.pr.monitor --args-json '{\"repo\":\"owner/repo\",\"pr\":123}'"

# Monitor PR and emit message only on change
$LOBSTER "workflows.run --name github.pr.monitor.notify --args-json '{\"repo\":\"owner/repo\",\"pr\":123}'"
```

## Approval Flow (Tool Mode)

When a pipeline hits `approve`, it returns:

```json
{
  "status": "needs_approval",
  "requiresApproval": {
    "prompt": "Send 3 emails?",
    "items": [...],
    "resumeToken": "eyJ..."
  }
}
```

To continue:
```bash
$LOBSTER resume --token "eyJ..." --approve yes
```

## Example Pipelines

```bash
# List recent PRs, filter merged, show as table
$LOBSTER 'exec --json --shell "gh pr list --repo owner/repo --json number,title,state --limit 20" | where "state=MERGED" | table'

# Get data, require approval, then process
$LOBSTER run --mode tool 'exec --json --shell "echo [{\"id\":1},{\"id\":2}]" | approve --prompt "Process these?" | pick id | json'

# Diff against last run (only emit on change)
$LOBSTER 'exec --json --shell "gh pr view 123 --repo o/r --json state,title" | diff.last --key "pr:o/r#123" | json'
```

## Workflow Files (.lobster)

YAML/JSON files with steps, conditions, and approval gates:

```yaml
name: pr-review-reminder
steps:
  - id: fetch
    command: gh pr list --repo ${repo} --json number,title,reviewDecision
  - id: filter
    command: jq '[.[] | select(.reviewDecision == "")]'
    stdin: $fetch.stdout
  - id: notify
    command: echo "PRs needing review:" && cat
    stdin: $filter.stdout
    approval: required
```

Run: `$LOBSTER run workflow.lobster --args-json '{"repo":"owner/repo"}'`

## Clawdbot Integration

Lobster can call Clawdbot tools via `clawd.invoke`:

```bash
$LOBSTER 'clawd.invoke --tool message --action send --args-json "{\"target\":\"123\",\"message\":\"hello\"}"'
```

Requires `CLAWD_URL` and `CLAWD_TOKEN` environment variables.

## State Directory

Lobster stores state in `~/.lobster/state/` by default. Override with `LOBSTER_STATE_DIR`.

Overview

This skill implements the Lobster workflow runtime for deterministic pipelines with approval gates. It runs typed JSON pipelines that halt for explicit human approval before performing side effects, saving tokens by avoiding re-planning each step. The runtime includes CLI commands, workflow files, state persistence, and integrations for monitoring and automation.

How this skill works

Lobster executes multi-step pipelines composed of simple commands and transforms, passing typed JSON between steps. When a pipeline reaches an approve step it returns a resume token and a needs_approval envelope; you can resume with an explicit yes/no decision. Persistent state and diffing let workflows detect changes and emit output only when useful, and built-in commands handle filtering, grouping, templating, and external tool invocation.

When to use it

  • Running multi-step automations that must pause for human confirmation before side effects
  • Monitoring PRs, issues, or other external resources and acting only on detected changes
  • Processing structured data through typed JSON pipelines with predictable transformations
  • Email triage, batch operations, or any workflow that should halt and ask before executing actions
  • Integrating with bot frameworks (Clawdbot) or shells while keeping a reproducible, deterministic runtime

Best practices

  • Model each step as a deterministic JSON-producing command to keep runs reproducible
  • Place approve gates right before actions with side effects to minimize token use and human attention
  • Use state.set/get and diff.last to only surface meaningful changes and avoid noisy alerts
  • Run in tool mode for integrations (JSON envelopes) and human mode for interactive debugging and pretty output
  • Store state in a controlled directory (LOBSTER_STATE_DIR) and rotate or back up state as part of ops

Example use cases

  • Monitor a GitHub PR and notify reviewers only when review state changes
  • Collect a batch of email messages, require approval, then trigger outbound sends
  • Run data processing pipelines that transform typed JSON and pause for manual validation before publishing results
  • Automate routine ops (cleanup, deploy prep) that must wait for a human approve step
  • Integrate with Clawdbot to send messages or invoke tools after manual confirmation

FAQ

How does approval resume work?

When approve is hit Lobster returns a needs_approval JSON envelope with a resumeToken. Call resume --token <token> --approve yes|no to continue the workflow.

Where is state stored and can I change it?

By default state is in ~/.lobster/state/. Override with the LOBSTER_STATE_DIR environment variable to point to another location.