Skip to content

Feature Request: Add environment variable support for captureStrategy, asyncMode, throttleMs #42

@jackyfan01

Description

@jackyfan01

Problem Description

The MemOS Cloud OpenClaw Plugin currently does not support environment variables for several important configuration parameters. These parameters can only be configured via openclaw.json plugin config, but not via ~/.openclaw/.env file.

Affected parameters:

  • captureStrategy (default: "last_turn")
  • asyncMode (default: true)
  • throttleMs (default: 0)
  • includeAssistant (default: true)
  • maxMessageChars (default: 20000)

Current Behavior

Users must modify openclaw.json to change these settings:

{
  "plugins": {
    "entries": {
      "memos-cloud-openclaw-plugin": {
        "enabled": true,
        "config": {
          "captureStrategy": "full_session",
          "asyncMode": false,
          "throttleMs": 0
        }
      }
    }
  }
}

Expected Behavior

These parameters should also be configurable via environment variables in ~/.openclaw/.env:

MEMOS_CAPTURE_STRATEGY=full_session
MEMOS_ASYNC_MODE=false
MEMOS_THROTTLE_MS=0
MEMOS_INCLUDE_ASSISTANT=true
MEMOS_MAX_MESSAGE_CHARS=20000

Impact

Use cases affected:

  1. Users who prefer centralized configuration in .env file
  2. Multi-environment deployments (dev/test/prod) need different settings
  3. Dynamic configuration changes without modifying openclaw.json
  4. Security concerns: openclaw.json might be committed to git

Proposed Solution

Modify buildConfig() function in lib/memos-cloud-api.js to read from environment variables:

const captureStrategy = 
  cfg.captureStrategy ?? 
  loadEnvVar("MEMOS_CAPTURE_STRATEGY") ?? 
  "last_turn";

const asyncMode = 
  cfg.asyncMode ?? 
  parseBool(loadEnvVar("MEMOS_ASYNC_MODE"), true);

const throttleMs = 
  cfg.throttleMs ?? 
  parseInt(loadEnvVar("MEMOS_THROTTLE_MS") || "0");

Priority order: plugin config > environment variable > default value

Environment

  • Plugin version: @memtensor/memos-cloud-openclaw-plugin@0.1.8
  • Node.js: v24.14.0
  • OS: Linux 5.10.134-19.2.al8.x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions