Skip to content

Configuration Model

Under development

The formal configuration model is being defined by the core team. This page describes the current working model.

LightMem2 uses a layered configuration model where settings cascade from broad defaults to specific overrides. Each layer overrides the previous one.

Configuration Layers

text
┌─────────────────────────────────┐
│  4. User overrides              │  ← Highest priority
│     (CLI flags, env vars)       │
├─────────────────────────────────┤
│  3. Plugin-level config         │
│     (plugin's own settings)     │
├─────────────────────────────────┤
│  2. Host-level config           │
│     (host's native config file) │
├─────────────────────────────────┤
│  1. Platform defaults           │  ← Lowest priority
│     (built-in sensible defaults)│
└─────────────────────────────────┘

Where Configuration Lives

HostConfig FilePlugin Config
OpenClaw~/.openclaw/openclaw.jsonInside the host config
Codex~/.codex/tokenpilot.jsonSeparate plugin config file
Claude Code~/.claude/tokenpilot.jsonSeparate plugin config file

Common Plugin Settings

These settings exist for all plugins:

json
{
  "enabled": true,
  "mode": "normal",
  "logLevel": "info"
}

TokenPilot adds its own settings (see TokenPilot Configuration).

Environment Variables

Adapters use environment variables for non-default paths:

VariablePurposeHost
LIGHTMEM2_OPENCLAW_HOMECustom OpenClaw home dirOpenClaw
OPENCLAW_CONFIG_PATHCustom config pathOpenClaw
CODEX_CONFIG_PATHCustom config.toml pathCodex
CODEX_HOOKS_CONFIG_PATHCustom hooks.json pathCodex
TOKENPILOT_CODEX_CONFIGCustom tokenpilot.json pathCodex
CLAUDE_CODE_SETTINGS_PATHCustom settings.json pathClaude Code
CLAUDE_CODE_MCP_CONFIG_PATHCustom .claude.json pathClaude Code
TOKENPILOT_CLAUDE_CODE_CONFIGCustom tokenpilot.json pathClaude Code

Resolving Configuration

At runtime, LightMem2:

  1. Reads platform defaults
  2. Reads the host config file
  3. Reads the plugin config file
  4. Applies environment variable overrides
  5. Applies CLI flag overrides

The resolved config is what plugins see at runtime.

Next

Released under the MIT License.