Inspect, checkpoint, rollback, and branch OpenClaw sessions with the ClawReverse plugin. Use when a user wants to recover from bad tool or file changes, rest...
---
name: clawreverse
description: Inspect, checkpoint, rollback, and branch OpenClaw sessions with the ClawReverse plugin. Use when a user wants to recover from bad tool or file changes, restore a known-good checkpoint, inspect session lineage, create a child branch from an earlier point, or avoid re-spending tokens after a long OpenClaw run. Do not use for plain git history operations or non-OpenClaw workspaces.
version: 0.1.0
homepage: https://github.com/OpenKILab/ClawReverse
metadata: {"openclaw":{"emoji":"⏪","homepage":"https://github.com/OpenKILab/ClawReverse","requires":{"bins":["openclaw"]}}}
---
# ClawReverse
Use this skill for OpenClaw session recovery and branching.
ClawReverse is a native OpenClaw plugin that adds the `openclaw reverse` command family for checkpoint listing, rollback, continue, checkout, and lineage inspection.
## Use this skill when
- a user wants to undo a bad OpenClaw tool call or recover from unwanted file changes
- a user wants to restore a known-good point without rerunning the whole task
- a user wants to branch from an earlier checkpoint and keep the parent session untouched
- a user wants to inspect checkpoint lineage, rollback status, rollback reports, or branch records
- a user wants to save tokens after a long analysis run by continuing from a checkpoint instead of starting over
## Do not use this skill when
- the task is a normal git revert, git checkout, or git branch workflow that should be handled directly with git
- the workspace is not managed by OpenClaw
- there are no OpenClaw sessions or checkpoints to operate on yet
## Key behavior you should know first
- ClawReverse creates checkpoints **before mutating tool calls**. Read-only tools and read-only shell commands do **not** create checkpoints.
- `rollback` rewinds the current session to a checkpoint. By default it does **not** restore the live workspace files unless `--restore-workspace` is used.
- `continue` requires a non-empty `--prompt` and creates a **new child agent, new workspace, and new session**, leaving the parent untouched.
- `checkout` creates a **new session in the same agent** from a checkpoint-backed entry. `--continue` can immediately start a run in that new session.
- `tree` is the fastest way to explain lineage and branch points to a user.
- Add `--json` whenever another tool needs machine-readable output.
## Prerequisites
- a working OpenClaw installation
- access to the machine that runs OpenClaw
- a valid `openclaw.json`
- the ClawReverse plugin files available in this skill bundle
## First step: verify or install the plugin
1. Check whether the plugin is already available:
```bash
openclaw reverse --help
```
2. If the command is missing, install the plugin from this skill bundle:
```bash
openclaw plugins install -l "{baseDir}"
```
3. Then initialize or repair config:
```bash
openclaw reverse setup
```
4. Restart the OpenClaw Gateway after install or config changes, then verify again:
```bash
openclaw reverse --help
```
If the OpenClaw state directory is not the default one, use:
```bash
openclaw reverse setup --base-dir /path/to/openclaw-state
```
## Default config created by `setup`
```json
{
"plugins": {
"allow": ["clawreverse"],
"enabled": true,
"entries": {
"clawreverse": {
"enabled": true,
"config": {
"workspaceRoots": ["~/.openclaw/workspace"],
"checkpointDir": "~/.openclaw/plugins/clawreverse/checkpoints",
"registryDir": "~/.openclaw/plugins/clawreverse/registry",
"runtimeDir": "~/.openclaw/plugins/clawreverse/runtime",
"reportsDir": "~/.openclaw/plugins/clawreverse/reports",
"maxCheckpointsPerSession": 100,
"allowContinuePrompt": true,
"stopRunBeforeRollback": true
}
}
}
}
}
```
## Standard workflow
### 1) Identify the target agent and session
```bash
openclaw reverse agents
openclaw reverse sessions --agent <agent-id>
```
Use the value in the `Agent` column as the `agent id` and the value in the `Session` column as the `session id`. The row marked `latest` is the newest session.
### 2) List checkpoints
```bash
openclaw reverse checkpoints --agent <agent-id> --session <session-id>
```
If you need details for one checkpoint:
```bash
openclaw reverse checkpoint --checkpoint <checkpoint-id>
```
### 3) Choose the correct action
#### Roll back the current line
Use this when the user wants to rewind the **current session** to an earlier point.
```bash
openclaw reverse rollback \
--agent <agent-id> \
--session <session-id> \
--checkpoint <checkpoint-id>
```
Only add `--restore-workspace` when the user explicitly wants the current on-disk workspace restored too:
```bash
openclaw reverse rollback \
--agent <agent-id> \
--session <session-id> \
--checkpoint <checkpoint-id> \
--restore-workspace
```
#### Continue as a safe child branch
Use this when the parent session and workspace must stay untouched and the user wants a fresh attempt from a known-good checkpoint.
```bash
openclaw reverse continue \
--agent <agent-id> \
--session <session-id> \
--checkpoint <checkpoint-id> \
--prompt "Continue from here with a different approach."
```
Optional advanced flags:
- `--new-agent <agent-id>` to force the child agent id
- `--clone-auth <auto|always|never>` for auth-copy behavior
- `--log` to capture child launch diagnostics and return `logFilePath`
#### Checkout into a new session in the same agent
Use this when the user wants a new session from a checkpoint-backed entry without creating a new agent.
```bash
openclaw reverse nodes --agent <agent-id> --session <session-id>
openclaw reverse checkout \
--agent <agent-id> \
--source-session <session-id> \
--entry <entry-id>
```
To start running immediately after checkout:
```bash
openclaw reverse checkout \
--agent <agent-id> \
--source-session <session-id> \
--entry <entry-id> \
--continue \
--prompt "Continue from this restored entry."
```
### 4) Inspect status, reports, and lineage
```bash
openclaw reverse rollback-status --agent <agent-id> --session <session-id>
openclaw reverse tree --agent <agent-id> --session <session-id>
openclaw reverse report --rollback <rollback-id>
openclaw reverse branch --branch <branch-id>
```
`tree` also supports automatic root selection and subtree inspection:
```bash
openclaw reverse tree
openclaw reverse tree --node <checkpoint-id>
```
## Command quick reference
| Command | Purpose |
|---|---|
| `openclaw reverse setup` | Patch `openclaw.json` and create plugin directories |
| `openclaw reverse status` | Show plugin runtime status |
| `openclaw reverse agents` | List configured agents |
| `openclaw reverse sessions --agent ...` | List sessions for one agent |
| `openclaw reverse checkpoints --agent ... --session ...` | List checkpoints for a session |
| `openclaw reverse checkpoint --checkpoint ...` | Inspect one checkpoint by id |
| `openclaw reverse rollback-status --agent ... --session ...` | Show rollback state for a session |
| `openclaw reverse rollback ...` | Rewind a session to a checkpoint |
| `openclaw reverse continue ... --prompt ...` | Create a child agent, workspace, and session from a checkpoint |
| `openclaw reverse nodes --agent ... --session ...` | List checkpoint-backed entries that support checkout |
| `openclaw reverse tree ...` | Display checkpoint lineage as a tree |
| `openclaw reverse checkout ...` | Create a new session from a checkpoint-backed entry |
| `openclaw reverse report --rollback ...` | Inspect a rollback report |
| `openclaw reverse branch --branch ...` | Inspect a saved branch record |
## Guardrails
- Prefer `continue` over `rollback` when the user wants to preserve the parent line untouched.
- Prefer `rollback` when the user wants the current line moved back to an earlier checkpoint.
- Ask before using `--restore-workspace` if the user has not clearly requested live file restoration.
- If no checkpoints appear, explain that ClawReverse only records checkpoints before mutating tools or mutating shell commands. Read-only operations such as `read`, `glob`, `ls`, `git status`, `find`, `cat`, `grep`, `diff`, `tree`, and similar commands are intentionally skipped.
- Use `--json` for programmatic parsing or when you want to feed results into another tool.
- From `{baseDir}`, `npm test` runs the repository test suite.
## Troubleshooting
### `openclaw reverse` is missing
- re-run `openclaw plugins install -l "{baseDir}"`
- run `openclaw reverse setup`
- restart the Gateway
- check that `clawreverse` is in `plugins.allow`
- check that `plugins.entries.clawreverse.enabled` is `true`
### `continue` fails
- make sure `--prompt` is non-empty
- if an agent id conflict occurs, retry with `--new-agent <fresh-id>`
- if you used `--log`, inspect the returned `logFilePath`
### `rollback` did not change files
That is expected unless `--restore-workspace` was used.
### `tree` or `checkpoints` shows nothing
- confirm the agent id and session id are correct
- confirm the session has mutating tool calls that could create checkpoints
don't have the plugin yet? install it then click "run inline in claude" again.
added explicit inputs (openclaw binary, plugin files, session context, gateway access), reorganized procedure into 5 numbered steps with clear input-output contracts, extracted decision logic into 8 explicit branches (continue vs rollback, checkpoints missing, agent conflict, json output, diagnostics, not found, file restoration), formalized output contract with concrete file paths and json schema, and defined outcome signal as observable user confirmations via commands and file state verification.
Recover from bad OpenClaw tool calls, restore known-good checkpoints, inspect session lineage, branch from earlier points, and save tokens by continuing from a checkpoint instead of rerunning. Use this skill when a user needs to undo mutations, restore a checkpoint, inspect branch structure, or create a child session without touching the parent. Do not use for plain git operations or non-OpenClaw workspaces.
ClawReverse is a native OpenClaw plugin that adds checkpoint, rollback, continue, checkout, and lineage inspection to OpenClaw sessions. Use this skill when a user wants to recover from a bad tool call or unwanted file changes, restore a known-good checkpoint without rerunning, branch from an earlier point, inspect checkpoint lineage and rollback status, or save tokens after a long run by continuing from a checkpoint instead of starting over. Do not use this skill for normal git workflows, non-OpenClaw workspaces, or when no OpenClaw sessions exist yet.
OpenClaw installation and access:
openclaw.json config file~/.openclaw)ClawReverse plugin files:
openclaw plugins install -l "{baseDir}")Session and agent context:
openclaw reverse agents)openclaw reverse sessions --agent <agent-id>)openclaw reverse checkpoints --agent <agent-id> --session <session-id>)External dependencies:
openclaw.json under plugins.entries.clawreverse.enabledStep 1: Verify or install the plugin
Input: OpenClaw binary, skill bundle location
openclaw reverse --help
openclaw plugins install -l "{baseDir}"
openclaw reverse setup
openclaw reverse setup --base-dir /path/to/openclaw-state
openclaw reverse --help
Output: plugin commands available and config created at ~/.openclaw/plugins/clawreverse/ (or custom base-dir).
Step 2: Identify target agent and session
Input: agent id and session id (or discover them)
openclaw reverse agents
openclaw reverse sessions --agent <agent-id>
Agent column value as agent-id and Session column value as session-id. The row marked latest is the newest session.Output: confirmed agent-id and session-id values.
Step 3: List and inspect checkpoints
Input: agent-id and session-id
openclaw reverse checkpoints --agent <agent-id> --session <session-id>
openclaw reverse checkpoint --checkpoint <checkpoint-id>
Output: list of checkpoint ids, timestamps, and associated tool calls; or single checkpoint details (timestamp, tool call, workspace state hash).
Step 4: Execute the chosen action
Input: agent-id, session-id, checkpoint-id, and user intent (rollback current line, branch safely, or checkout)
Rollback current session (rewind without branching):
openclaw reverse rollback \
--agent <agent-id> \
--session <session-id> \
--checkpoint <checkpoint-id>
If user explicitly wants on-disk workspace files restored too:
openclaw reverse rollback \
--agent <agent-id> \
--session <session-id> \
--checkpoint <checkpoint-id> \
--restore-workspace
Output: session history rewound, rollback-id returned. Current session state reset to checkpoint. (Workspace files unchanged unless --restore-workspace used.)
Continue as child branch (safe new attempt from checkpoint):
openclaw reverse continue \
--agent <agent-id> \
--session <session-id> \
--checkpoint <checkpoint-id> \
--prompt "Continue from here with a different approach."
Optional flags:
--new-agent <agent-id> to force the child agent id (avoid conflict)--clone-auth <auto|always|never> to control auth token copying to child--log to capture child launch diagnostics (returns logFilePath)Output: new agent-id, new session-id, new workspace path, child session ready to run. Parent session and workspace left untouched.
Checkout to new session in same agent (no branching, same agent):
openclaw reverse nodes --agent <agent-id> --session <session-id>
(First, list checkpoint-backed entries.)
openclaw reverse checkout \
--agent <agent-id> \
--source-session <session-id> \
--entry <entry-id>
To start a run immediately after checkout:
openclaw reverse checkout \
--agent <agent-id> \
--source-session <session-id> \
--entry <entry-id> \
--continue \
--prompt "Continue from this restored entry."
Output: new session-id in same agent, created from checkpoint-backed entry. If --continue used, session immediately starts running.
Step 5: Inspect status, reports, and lineage
Input: agent-id, session-id, rollback-id, branch-id (as applicable)
openclaw reverse rollback-status --agent <agent-id> --session <session-id>
openclaw reverse tree --agent <agent-id> --session <session-id>
openclaw reverse report --rollback <rollback-id>
openclaw reverse branch --branch <branch-id>
Tree inspection also supports auto-root and subtree modes:
openclaw reverse tree
openclaw reverse tree --node <checkpoint-id>
Output: rollback status (state, timestamp), lineage tree (checkpoint hierarchy, branches, nodes), rollback report (what was wound back, diagnostics), branch record (parent, child, metadata).
If user wants to undo a tool call but preserve the parent session:
Use continue with a new agent, workspace, and session. The parent remains untouched and can be inspected later. Parent stays in the original state; child gets a fresh attempt from the checkpoint.
If user wants to rewind the current session to an earlier point:
Use rollback. The current session history is rewound. On-disk workspace files remain unchanged by default. Only add --restore-workspace if user has explicitly requested file restoration; otherwise, ask before applying it.
If no checkpoints appear in the listing: Explain that ClawReverse only records checkpoints before mutating tool calls. Read-only tools (read, glob, ls, git status, find, cat, grep, diff, tree) and read-only shell commands do not create checkpoints. If the user needs checkpoints, they must perform a mutating action (file write, tool that modifies state).
If continue needs a distinct agent ID (conflict with existing agent):
Use --new-agent <fresh-id> to force a new agent identifier. If auth tokens must be copied to the child agent, use --clone-auth auto (default) or --clone-auth always.
If output must be machine-readable (fed into another tool or script):
Add --json flag to any listing or inspection command (checkpoints, rollback-status, tree, report, branch) to get structured JSON output.
If rollback fails or logs are needed for diagnosis:
For continue, use --log to capture launch diagnostics and return the logFilePath for inspection.
If ClawReverse command is not found after install:
Re-run openclaw plugins install -l "{baseDir}", then openclaw reverse setup, restart the Gateway, and verify clawreverse is in plugins.allow and plugins.entries.clawreverse.enabled is true.
Plugin setup success:
openclaw reverse --help runs without erroropenclaw.json with structure:{
"plugins": {
"allow": ["clawreverse"],
"enabled": true,
"entries": {
"clawreverse": {
"enabled": true,
"config": {
"workspaceRoots": ["~/.openclaw/workspace"],
"checkpointDir": "~/.openclaw/plugins/clawreverse/checkpoints",
"registryDir": "~/.openclaw/plugins/clawreverse/registry",
"runtimeDir": "~/.openclaw/plugins/clawreverse/runtime",
"reportsDir": "~/.openclaw/plugins/clawreverse/reports",
"maxCheckpointsPerSession": 100,
"allowContinuePrompt": true,
"stopRunBeforeRollback": true
}
}
}
}
}
~/.openclaw/plugins/clawreverse/ (checkpoints, registry, runtime, reports)Agent and session listing:
--json output as array of objects with agent_id, session_id, timestamp, statusCheckpoint listing:
--json output as array of checkpoint objectsRollback execution:
--restore-workspace)--json output with rollback_id, agent_id, session_id, timestamp, statusContinue execution:
~/.openclaw/workspace/{new-agent-id}/)--prompt run--json output with new_agent_id, new_session_id, workspace_path, parent_agent_id, parent_session_id, logFilePath (if --log used)Checkout execution:
--continue used, session immediately starts running with provided prompt--json output with new_session_id, agent_id, source_entry_id, statusStatus, tree, report, and branch inspection:
rollback-status: plaintext summary of rollback state (completed, pending, failed) with timestamp and checkpoint idtree: plaintext tree diagram showing checkpoint hierarchy, branch points, and child sessions; or --json tree structurereport: plaintext rollback report with what was wound back, diagnostics, and any warningsbranch: plaintext branch record with parent agent/session, child agent/session, timestamp, and metadataopenclaw reverse checkpoints or openclaw reverse tree that the checkpoint list matches their expectation and the session has the right history.rollback, user verifies that openclaw reverse checkpoints --agent ... --session ... now shows truncated history ending at the target checkpoint.continue, user confirms via openclaw reverse agents and openclaw reverse sessions that a new agent and session exist, distinct from the parent, and the parent remains unchanged.checkout, user verifies that openclaw reverse sessions --agent <same-agent> shows a new session id, restored from the checkpoint-backed entry.--restore-workspace was used, user inspects the on-disk workspace and confirms that files are now in the state they were at the target checkpoint (not at the later, rolled-back state).openclaw reverse tree, they see the branch or rollback point clearly marked, confirming the operation was recorded.credits: original skill by binhuangpjlab (clawhub). enriched per Implexa quality standards.