← Back to Plugins
Tools

Goals

MrDiamondBallz By MrDiamondBallz 👁 391 views ▲ 0 votes

Persistent, checkpointed goal-oriented task engine for OpenClaw. Set an objective, walk away, and it finishes โ€” surviving restarts, crashes, and timeouts. Please leave your feedback!

Homepage GitHub

Install

npm install &&

Configuration Example

{
  "plugins": {
    "entries": {
      "openclaw-goals": {
        "enabled": true,
        "config": {
          "max_concurrent": 3,
          "watchdog_interval_ms": 30000,
          "stale_heartbeat_seconds": 120,
          "default_max_steps": 200,
          "max_retries": 3
        }
      }
    }
  }
}

README

# ๐Ÿฆž openclaw-goals

**Persistent, checkpointed goal-oriented task engine for OpenClaw.**

Set an objective, walk away, and the agent finishes it โ€” surviving restarts, crashes, and timeouts. Native OpenClaw plugin, no external dependencies.

## Features

- **Persistent state** โ€” goals survive gateway restarts, worker crashes, OOM kills
- **Checkpoint-aware workers** โ€” sub-agents write progress after every step; resume exactly where they left off
- **Automatic recovery** โ€” watchdog re-spawns crashed workers within 30 seconds
- **Step budgeting** โ€” prevents runaway costs with configurable step limits
- **User notification** โ€” alerts you when a goal needs input or completes
- **CLI + Agent tools** โ€” manage goals from chat or terminal

## Quick Start

```bash
# Install from GitHub
openclaw plugins install git+https://github.com/MrDiamondBallz/openclaw-goals

# Or local dev
cd openclaw-goals
npm install && npm run build
openclaw plugins install .
```

After install, restart the gateway: `openclaw gateway restart`

## Usage

### Via agent chat

```
You: start a goal: refactor auth middleware to JWT
Agent: โœ… Goal started! Objective: refactor auth middleware to JWT

You: goal status
Agent: ๐Ÿ”„ goal-auth-refactor โ€” active โ€” 47/200 steps โ€” 2h ago

You: goal pause
Agent: โธ๏ธ Paused at step 47.

You: goal resume
Agent: โ–ถ๏ธ Resumed from step 47.
```

### Via CLI

```bash
openclaw goal list
openclaw goal status <goal-id>
openclaw goal cancel <goal-id>
```

## Configuration

```json
{
  "plugins": {
    "entries": {
      "openclaw-goals": {
        "enabled": true,
        "config": {
          "max_concurrent": 3,
          "watchdog_interval_ms": 30000,
          "stale_heartbeat_seconds": 120,
          "default_max_steps": 200,
          "max_retries": 3
        }
      }
    }
  }
}
```

| Option | Default | Description |
|--------|---------|-------------|
| `max_concurrent` | 3 | Goals running at once |
| `watchdog_interval_ms` | 30000 | Health check frequency |
| `stale_heartbeat_seconds` | 120 | Worker declared dead after |
| `default_max_steps` | 200 | Step budget per goal |
| `max_retries` | 3 | Recovery attempts before failure |

## Architecture

```
openclaw-goals/
โ”œโ”€โ”€ openclaw.plugin.json    # Plugin manifest
โ”œโ”€โ”€ package.json            # npm package
โ”œโ”€โ”€ SKILL.md                # Agent usage docs (loaded by OpenClaw)
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ index.ts            # Plugin entry โ€” tools + commands + lifecycle
โ”‚   โ”œโ”€โ”€ manager.ts          # Atomic state CRUD
โ”‚   โ”œโ”€โ”€ worker.ts           # Sub-agent spawn + prompt builder
โ”‚   โ”œโ”€โ”€ watchdog.ts         # Stale detection + recovery logic
โ”‚   โ””โ”€โ”€ types.ts            # Goal state schema + config types
โ””โ”€โ”€ goals/                  # State directory (created at runtime)
```

**Goal state** lives in `goals/goal-<id>.json` โ€” atomic writes via temp+rename. No corruption.

**Worker** is an isolated sub-agent spawned via `api.runtime.subagent.run()` with a long timeout and the goal prompt.

**Watchdog** runs as an interval inside `gateway_start` โ†’ `gateway_stop` lifecycle hooks. It scans for stale heartbeats, re-spawns dead workers, and notifies on `awaiting_input`.

## For Developers

```bash
npm install
npm run build     # compiles src/ โ†’ dist/
npm run clean     # removes dist/
```

## How it compares

| Feature | Codex `/goal` | Claude Code | openclaw-goals |
|---------|:---:|:---:|:---:|
| Survives terminal close | โœ… | โŒ | โœ… |
| Survives gateway restart | โŒ | โŒ | โœ… |
| Background watchdog | โŒ | โŒ | โœ… |
| Native OpenClaw integration | โŒ | โŒ | โœ… |
| Step budgeting | โŒ | โŒ | โœ… |
| Pause/resume | โœ… | โœ… | โœ… |
| State persistence | file-based | memory | atomic JSON |

## Install from source

```bash
git clone https://github.com/MrDiamondBallz/openclaw-goals.git
cd openclaw-goals
npm install && npm run build
openclaw plugins install .
openclaw gateway restart
```

## License

MIT
tools

Comments

Sign in to leave a comment

Loading comments...