Tools
Goals
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!
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