OpenClaw
OpenClaw is the primary host for LightMem2, with the deepest integration via a native plugin slot.
Test Environment
OS: macOS 14 / Linux (Ubuntu 22.04) | Node: v20+ | Last verified: 2026-07-16
Installation
bash
pnpm component:install:tokenpilot:openclawThis command:
- Updates
~/.openclaw/openclaw.json - Enables the TokenPilot plugin
- Switches
plugins.slots.contextEnginetolayered-context - Sets the default
normalmode - Attempts to restart the OpenClaw gateway
Custom Paths
bash
export LIGHTMEM2_OPENCLAW_HOME="/path/to/openclaw-home"
export OPENCLAW_CONFIG_PATH="/path/to/openclaw.json"
pnpm component:install:tokenpilot:openclawExpected Output
After install, your ~/.openclaw/openclaw.json will include a TokenPilot section:
json
{
"plugins": {
"slots": {
"contextEngine": "layered-context"
},
"entries": {
"tokenpilot": {
"enabled": true,
"mode": "normal"
}
}
}
}Verification
Inside an OpenClaw session:
text
/lightmem2 statusExpected output:
plugin entry enabledconfig enabledmode normalcontext engine slot layered-contextstabilizer enabledreduction enabled
For a fuller check:
text
/lightmem2 doctor
/lightmem2 report
/lightmem2 visualIn-Session Commands
OpenClaw supports in-session slash commands:
text
/lightmem2 status # View current status
/lightmem2 report # Session token/cost report
/lightmem2 doctor # Integration self-check
/lightmem2 visual # Open visual inspector
/lightmem2 mode normal # Switch mode
/lightmem2 stabilizer target developer
/lightmem2 reduction mode balanced
/lightmem2 eviction on
/lightmem2 help # List all commandsStandalone CLI
Commands also work outside OpenClaw:
bash
lightmem2 openclaw status
lightmem2 openclaw report
lightmem2 openclaw doctor
lightmem2 openclaw visual
lightmem2 openclaw mode normal
lightmem2 openclaw session <session-id> reportModel Selection
Use models with the lightmem2/ prefix:
text
lightmem2/gpt-5.4-miniThis routes through TokenPilot's context management pipeline.
Useful Controls
mode aggressive— maximum savingseviction on|off— lifecycle-aware context evictionsettings details on— expanded status outputstabilizer ...andreduction ...— fine-tune stabilization and reduction
Failure Recovery
If the install fails or you need to roll back:
bash
# Restore original config
cp ~/.openclaw/openclaw.json.tokenpilot.bak ~/.openclaw/openclaw.json
# Restart OpenClaw
# (use your normal restart method)Troubleshooting
See TokenPilot Troubleshooting for OpenClaw-specific issues.