This commit addresses the issue of duplicate assistant messages appearing
in the conversation history by commenting out the lines that were
unnecessarily pushing assistant responses to the conversationHistory array.
The processAgentResponse function already handles adding assistant messages
to the conversation history, so these additional pushes were causing
duplicate entries.
Changes made:
- Commented out session.conversationHistory.push calls for assistant responses
in three locations within OpenRouterAgent.ts:
1. In the init response handling (around line 117)
2. In the observation response handling (around line 188)
3. In the summary response handling (around line 230)
This ensures that assistant messages are only added once to the conversation
history, preventing duplication while maintaining the intended functionality.
Co-authored-by: 张坤 <zhangkun@example.com>
v1beta does not support newer models like gemini-3-flash, causing
silent 404 errors that back up the observation queue indefinitely.
Users with CLAUDE_MEM_GEMINI_MODEL=gemini-3-flash get zero observations
stored, with no visible error — the queue just grows silently.
Changes:
- Switch API URL from v1beta/models to v1/models (generateContent
works identically on both endpoints)
- Add gemini-3-flash to GeminiModel type and RPM limits
- Update test to match new endpoint
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
The summarize (Stop) and observation (PostToolUse) handlers throw
blocking errors (exit code 2) when optional input fields like
transcriptPath, toolName, or cwd are missing. This causes visible
hook errors on every session stop and after some tool uses.
Replace throws with graceful returns matching the existing pattern
used for worker-unavailable checks.
Fixes#1097
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Users may assume `npm install -g claude-mem` sets up the full plugin,
but it only installs the SDK/library. Added a note to both the README
and the installation guide making this distinction explicit.
Co-authored-by: Markus <glucksberg89@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Address PR #1125 review feedback - both fetches now start simultaneously
via Promise.all instead of sequential-then-parallel.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add systemMessage field to HookResult so SessionStart can display a
colored timeline directly to the user in the CLI. The handler now
parallel-fetches both markdown (for Claude context) and ANSI-colored
(for user display) timelines, appending a viewer URL link.
Also update default settings to hide verbose token columns (read/work
tokens, savings amount) and disable full observation expansion, keeping
the cleaner index-only view by default.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wrap SDK query loop in try/finally so subprocess cleanup runs on error paths.
Swap Chroma binary check order to try project-level .bin first (common case).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Chroma requires client-side embeddings — the server is storage only.
The previous commit incorrectly removed @chroma-core/default-embed.
Uses DefaultEmbeddingFunction({ wasm: true }) which forces the WASM
backend instead of native ONNX binaries. Same model (all-MiniLM-L6-v2),
same embeddings, but works on all platforms without segfaults or
ENOENT errors (#1104, #1105, #1110).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Strip CLAUDECODE env var from SDK subprocesses to prevent "cannot be
launched inside another Claude Code session" error (Claude Code 2.1.42+)
- Lazy-load @chroma-core/default-embed to avoid eagerly pulling in
sharp native binaries at bundle startup (fixes ERR_DLOPEN_FAILED)
- Add stderr capture to SDK spawn for diagnosing future process failures
- Exclude lockfiles from marketplace rsync and delete stale lockfiles
before npm install to prevent native dep version mismatches
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve conflicts between Chroma HTTP server PR and main branch changes
(folder CLAUDE.md, exclusion settings, Zscaler SSL, transport cleanup).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace raw.githubusercontent.com URLs with install.cmem.ai/openclaw.sh
across install script, SKILL.md, and docs. Add OpenClaw section with
install one-liner to README.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Serves openclaw/install.sh at install.cmem.ai/openclaw.sh via Vercel.
Auto-deploys on changes to openclaw/install.sh on main.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three fixes for the OpenClaw plugin:
1. Fix MEMORY.md sync returning empty content
- syncMemoryToWorkspace() was querying basename(workspaceDir) as the
project name (e.g. 'workspace'), but observations are stored under
agent-scoped names like 'openclaw-main'
- Now queries both the base project and agent-scoped project name
- Passes EventContext through so the correct project can be derived
2. Add dedicated botToken support for observation feed
- New optional 'botToken' field in observationFeed config
- When set, sends observations directly via Telegram Bot API instead
of routing through the gateway's channel plugin
- Allows using a separate bot for the observation stream
3. Fix plugin kind for memory slot compatibility
- Changed plugin kind from 'integration' to 'memory' so OpenClaw
recognizes it as a valid memory slot plugin
- Fixes 'memory slot plugin not found' warning when
plugins.slots.memory = 'claude-mem' is configured
Remove arbitrary TOOL_RESULT_MAX_LENGTH truncation, capture all content
blocks instead of only the first, observe all tool uses including
memory_ tools, and filter context injection by workspace directory
instead of hardcoded project name.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two-stage health verification (health + readiness), 30s timeout,
parse_health_json() helper with jq/python3/node fallbacks, smart
port-conflict handling with version/provider mismatch detection,
and enhanced completion summary showing version, AI auth, and uptime.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace hardcoded TEST-008 build ID with real package version. Add worker
filesystem path, uptime counter, and AI provider status (including last
interaction success/failure tracking) to the health endpoint response.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The stale config cleanup removed plugins.entries['claude-mem'] but left
plugins.slots.memory pointing to it. OpenClaw's config validator rejects
ALL CLI commands when a slot references a non-existent plugin, blocking
`openclaw plugins install` from running.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
OpenClaw's config validator rejects unrecognized keys and references to
uninstalled plugins, blocking ALL CLI commands including `plugins install`.
The installer now temporarily removes the stale claude-mem entry before
installing, then restores the saved plugin config (workerPort, observationFeed,
etc.) after successful installation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The installer always cloned from main branch, making it impossible to test
changes on feature branches. Added --branch flag (e.g. --branch=openclaw-installer)
to override the default.
Also fixes "plugin already exists" error by removing the existing plugin
directory (~/.openclaw/extensions/claude-mem) before running plugins install,
allowing clean reinstallation without manual cleanup.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The before_agent_start handler was passing ctx.sessionKey (e.g. "agent:main:main")
as the prompt to the worker API, causing the viewer to display the session key
instead of actual user prompt text. Now correctly reads event.prompt from
OpenClaw's BeforeAgentStartEvent.
Also adds message_received hook to capture inbound user prompts from messaging
channels (Telegram, Discord, etc.) and stores them via the worker API.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
find_openclaw() only searched for openclaw.mjs, missing systems where the
binary is named just "openclaw" (e.g., npm install -g openclaw). Now checks
both names in PATH and in hardcoded paths. Added run_openclaw() helper that
invokes via node for .mjs files and directly for standalone binaries.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Addresses PR review feedback: bash variable interpolation into JavaScript
string literals could allow injection if paths contain special characters.
All 4 node -e calls now receive paths via process.env instead of ${var}
interpolation: package.json writer, config creator, config updater, and
PID file writer.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>