Tools
Retrac Openclaw
Re-TRAC is an OpenClaw plugin that implements the paper-style runtime from [Re-TRAC](https://arxiv.org/pdf/2602.02486): exploration is organized by `explorationGroupKey`, executed in rounds, compressed into structured round state, and continued using only the compressed state from previous rounds.
Install
npm install
npm
Configuration Example
{
"plugins": {
"entries": {
"retrac": {
"enabled": true,
"config": {
"storagePath": "~/.openclaw/retrac-states",
"enableRedundancyCheck": true,
"maxStoredTrajectories": 100,
"summarizerModelSource": "openclaw_default",
"compressionStrategy": "hybrid"
}
}
}
}
}
README
# Re-TRAC Plugin for OpenClaw
Re-TRAC is an OpenClaw plugin that implements the paper-style runtime from [Re-TRAC](https://arxiv.org/pdf/2602.02486): exploration is organized by `explorationGroupKey`, executed in rounds, compressed into structured round state, and continued using only the compressed state from previous rounds.
## What changed
This plugin is no longer a simple "inject old session history into the prompt" helper.
It now models:
- `ExplorationGroup` for the whole research task
- `ExplorationRound` for each rollout/compression cycle
- `TrajectoryRecord` for each session/subagent branch
- `StructuredRoundState` for the paper-style compressed state `S_t`
## Runtime model
The intended runtime is:
1. Multiple sibling trajectories explore in parallel under the same `explorationGroupKey`
2. Each trajectory keeps its own `sessionId` / `sessionKey`
3. Re-TRAC records tool calls, sources, failures, branches, and reflections per trajectory
4. When a round finishes, the plugin compresses all trajectories in that round into `StructuredRoundState`
5. The next round receives only the previous round's compressed continuation state
## Tools
- `reflect_round`: enrich the current trajectory with explicit evidence, failed attempts, gaps, and next branches
- `plan_next_round`: generate next-round branches using the current group/round context plus prior compressed state
- `get_retrac_state`: inspect group / round / trajectory views
- Legacy aliases remain available for compatibility: `reflect`, `plan`, `get_trajectory_state`
## Automatic behavior
- Records tool execution into the active trajectory
- Persists `group`, `round`, `trajectory`, and `state` entities to disk
- Injects only the previous round's continuation state in `before_prompt_build`
- Warns when a tool call looks redundant relative to sibling trajectories or previous round state
- Redundancy checks now include semantic heuristics for same-source URLs/paths and highly similar search intents, not just exact parameter equality
## Storage layout
By default state is stored under `~/.openclaw/retrac-states`:
```text
groups/<groupKey>.json
rounds/<groupKey>/<roundIndex>.json
trajectories/<trajectoryId>.json
states/<groupKey>/<roundIndex>.json
```
## Configuration
Add this plugin under `plugins.entries.retrac.config`:
```json
{
"plugins": {
"entries": {
"retrac": {
"enabled": true,
"config": {
"storagePath": "~/.openclaw/retrac-states",
"enableRedundancyCheck": true,
"maxStoredTrajectories": 100,
"summarizerModelSource": "openclaw_default",
"compressionStrategy": "hybrid"
}
}
}
}
}
```
Notes:
- `maxStoredTrajectories` now applies per `explorationGroupKey`
- `summarizerModelSource: "openclaw_default"` means Re-TRAC will resolve its preferred summarizer model from the same OpenClaw default-model logic used by the host
- `compressionStrategy: "rules"` keeps the old deterministic compressor only
- `compressionStrategy: "hybrid"` runs the rule-based compressor first, then asks the host LLM to refine high-level synthesis fields
- In hybrid mode, each saved round state records `preferredSummarizerModel`, `llmRun`, and `llmSummary` under `compressionMetadata`
- To get true paper-style behavior, the host should propagate `explorationGroupKey` and `roundIndex`
- If those fields are absent, the plugin falls back to `sessionKey` and round `0`
## Local development
```bash
npm install
npm run build
npm test
```
## Smoke checklist
After enabling the plugin in OpenClaw:
1. Start a complex task and call `plan_next_round`
2. Spawn sibling branches with `sessions_spawn`
3. Use `reflect_round` inside branches after meaningful progress or failure
4. Confirm `get_retrac_state` shows group / round / trajectory data
5. Start the next round and confirm only the previous round's compressed state is injected
tools
Comments
Sign in to leave a comment