Install Your First Plugin
After installing LightMem2, install a plugin to add capabilities. Currently, TokenPilot is the only official plugin.
Install TokenPilot
Pick your host:
OpenClaw
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:openclawCodex
bash
npm --prefix components/adapters/codex run build
npm --prefix components/adapters/codex run install:codexThis command:
- Reroutes your active Codex provider through the local TokenPilot proxy
- Writes
~/.codex/tokenpilot.json - Registers hooks in
~/.codex/hooks.json - Registers the shared
tokenpilot_memory_fault_recoverMCP server
Custom paths:
bash
export CODEX_CONFIG_PATH="/path/to/config.toml"
export CODEX_HOOKS_CONFIG_PATH="/path/to/hooks.json"
export TOKENPILOT_CODEX_CONFIG="/path/to/tokenpilot.json"
npm --prefix components/adapters/codex run build
npm --prefix components/adapters/codex run install:codexClaude Code
bash
npm --prefix components/adapters/claude-code run build
npm --prefix components/adapters/claude-code run install:claude-codeThis command:
- Updates
~/.claude/settings.jsonfor local gateway routing - Writes
~/.claude/tokenpilot.json - Registers the shared
tokenpilot_memory_fault_recoverMCP server - Installs a
SessionStarthook that auto-starts the gateway - Backs up existing Claude files as
.tokenpilot.bak
Custom paths:
bash
export CLAUDE_CODE_SETTINGS_PATH="/path/to/settings.json"
export CLAUDE_CODE_MCP_CONFIG_PATH="/path/to/.claude.json"
export TOKENPILOT_CLAUDE_CODE_CONFIG="/path/to/tokenpilot.json"
npm --prefix components/adapters/claude-code run build
npm --prefix components/adapters/claude-code run install:claude-codeVerify Installation
bash
lightmem2 doctorOr check per-host:
bash
lightmem2 openclaw doctor
lightmem2 codex doctor
lightmem2 claude-code doctorLook for: plugin entry enabled, config enabled, proxy healthy: yes.
What Changed
The installer modifies these files (backups saved as .tokenpilot.bak):
| Host | Files Modified |
|---|---|
| OpenClaw | ~/.openclaw/openclaw.json |
| Codex | ~/.codex/tokenpilot.json, ~/.codex/hooks.json |
| Claude Code | ~/.claude/settings.json, ~/.claude/tokenpilot.json, ~/.claude/.claude.json |
Next
- Runtime Modes — choose your risk/aggressiveness level
- CLI Reference — all available commands
- Troubleshooting — common install issues