Commit Graph

50 Commits

Author SHA1 Message Date
Daniel M. b1498c321b Respect existing installPath and plugins.load.paths in installer (#1116)
The installer hardcoded ~/.openclaw/extensions/claude-mem as the target.
Users who moved the extension to a custom path (e.g. workspace
extensions via plugins.load.paths) would have their setup broken on
update. Now resolve_extension_dir() checks the OpenClaw config for an
existing installPath or load.paths entry before falling back to the
default.
2026-02-16 00:34:54 -05:00
Daniel M. 62b1618fbd Fix installer overwriting package.json and losing openclaw.extensions (#1113)
The update step copies the root package.json over the extension's
package.json, wiping the openclaw.extensions field that plugin
discovery requires. This causes "plugin not found: claude-mem" after
every update. Merge only the version number instead.

Fixes #1106
2026-02-16 00:34:26 -05:00
Alex Newman ab2dbb7dc7 Rename Telegram bot commands from hyphens to underscores (#1126)
Telegram Bot API only allows a-z, 0-9, and underscores in command
names. Rename /claude-mem-feed → /claude_mem_feed and
/claude-mem-status → /claude_mem_status.

Fixes #1108

Co-authored-by: Manantra <113709296+Manantra@users.noreply.github.com>
2026-02-16 00:33:55 -05:00
Daniel M. be474ea595 Fix command handlers to return { text } per OpenClaw plugin API (#1115)
The OpenClaw plugin API requires command handlers to return
{ text: string } objects. Returning plain strings causes
"reply missing text/media" errors and commands silently fail
to send responses to Telegram/other channels.
2026-02-16 00:32:04 -05:00
Alex Newman cef15011c2 openclaw: add Claude-Mem search and timeline commands (#1069)
Co-authored-by: Alex Newman <alexnewman@Alexs-Mac-mini.local>
2026-02-16 00:30:08 -05:00
Alex Newman 7bf792b467 openclaw: convert make-plan and do-plan commands to skills (#1070)
Move the /make-plan and /do orchestrator commands from plugin/commands/
into OpenClaw skills (openclaw/skills/make-plan, openclaw/skills/do-plan).

Skills are auto-discovered by the agent and loaded on-demand via SKILL.md
frontmatter matching, reducing context cost vs always-loaded slash commands.

Register skill directories in openclaw.plugin.json via the skills array.

Co-authored-by: Alex Newman <alexnewman@Alexs-Mac-mini.local>
2026-02-16 00:30:02 -05:00
Glucksberg 55e0e323b9 feat: universalize observation feed emojis (#1100)
* feat: universalize observation feed emojis with config-driven system

Replace hardcoded AGENT_EMOJI_MAP with a three-tier approach:
1. User-pinned emojis via observationFeed.emojis.agents config
2. Deterministic auto-assign from pool using agentId hash
3. Configurable fallbacks for primary, Claude Code, and default emojis

Claude Code sessions now display "Claude Code Session" instead of the
working directory name. All emoji settings are exposed in the plugin
configSchema so the onboarding wizard AI can discover and configure them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(feed): keep Claude Code project id in source labels

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 00:29:55 -05:00
Alex Newman f435ae32ce docs: update openclaw install URLs to install.cmem.ai
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>
2026-02-13 01:46:49 -05:00
Alex Newman 5de728612e chore: bump version to 10.0.6
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 00:02:37 -05:00
Alex Newman 6cad77328b fix(openclaw): fix MEMORY.md project query mismatch and add feed botToken support
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
2026-02-12 23:48:44 -05:00
Alex Newman c469e0acc3 fix: remove opinionated filters from OpenClaw plugin
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>
2026-02-12 22:14:16 -05:00
Alex Newman 1d76f93304 feat: harden installer with rich health check diagnostics
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>
2026-02-12 21:58:15 -05:00
Alex Newman 095f6fde47 fix: also remove stale memory slot reference during reinstall cleanup
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>
2026-02-12 18:55:59 -05:00
Alex Newman 1130bbc090 fix: handle stale plugin config that blocks OpenClaw CLI during reinstall
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>
2026-02-12 18:41:44 -05:00
Alex Newman 76f984ce7c fix: add --branch flag and handle existing plugin on reinstall
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>
2026-02-12 17:10:59 -05:00
Alex Newman 6535ad597f fix: use event.prompt instead of ctx.sessionKey for prompt storage in OpenClaw plugin
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>
2026-02-12 16:17:32 -05:00
Alex Newman 40f81b4d2b fix: detect both openclaw and openclaw.mjs binary names in gateway discovery
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>
2026-02-12 15:12:29 -05:00
Alex Newman 54ca601e8f fix: pass file paths via env vars instead of bash interpolation in node -e calls
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>
2026-02-12 15:04:13 -05:00
Alex Newman de549cac05 Update openclaw/install.sh
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-12 12:37:50 -05:00
Alex Newman 83d474b13d Update openclaw/install.sh
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-12 12:37:42 -05:00
Alex Newman 9480ef06ab Update openclaw/install.sh
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-12 12:36:28 -05:00
Alex Newman c099e8eb27 Update openclaw/install.sh
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-12 12:36:14 -05:00
Alex Newman 1325f05432 MAESTRO: finalize distribution with one-liner installer in SKILL.md and distribution readiness tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 01:38:32 -05:00
Alex Newman cfd19ae232 MAESTRO: fix check_uv test to handle system-path uv installations
The check_uv not-found test was failing because find_uv_path checks
hardcoded system paths (/opt/homebrew/bin/uv, /usr/local/bin/uv) that
can't be overridden via HOME or PATH. Added graceful skip when uv is
installed at non-overridable system paths.

All 171/171 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 01:34:27 -05:00
Alex Newman cb6ff8738b MAESTRO: add error recovery, upgrade handling, and edge case hardening to install.sh
- Add --upgrade flag that detects existing installations and skips clone/build/register
- Add global trap-based cleanup (register_cleanup_dir + cleanup_on_exit) for temp dirs
- Add check_git() with platform-specific install suggestions (xcode-select on macOS, apt on Linux)
- Add check_port_37777() to detect worker already running before starting a new one
- Add is_claude_mem_installed() for upgrade detection via plugin directory check
- Add ensure_jq_or_fallback() utility for JSON operations with jq/node fallback
- All 160 tests pass (23 new tests for error handling functions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 22:10:39 -05:00
Alex Newman 81ebb8b6c0 MAESTRO: add TTY detection, --provider/--api-key flags, and curl | bash support to install.sh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 22:06:20 -05:00
Alex Newman 9bdd00ea5a MAESTRO: add jq/python3/node fallback chain for observation feed config writing
write_observation_feed_config() now uses jq as the primary JSON
manipulation tool, falls back to python3, then to node. This gives
users the most reliable path regardless of their system tooling.
Added 15 new tests covering all three fallback paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 21:59:19 -05:00
Alex Newman 6f35e543ca MAESTRO: add observation feed interactive setup, config writer, and updated completion summary to install.sh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 21:55:24 -05:00
Alex Newman ee61270e1b MAESTRO: validate install.sh — fix IS_WSL bug and API key injection in write_settings
- Fixed IS_WSL=false (non-empty string) causing "(WSL)" to always display
  on Linux platforms; now uses empty string initialization
- Refactored write_settings() to pass API key via environment variables
  instead of interpolating into JavaScript string literals, preventing
  potential injection or breakage with special characters
- Passes bash -n and shellcheck with zero warnings
- All 74/74 existing tests pass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 21:51:09 -05:00
Alex Newman e902b74267 MAESTRO: add worker startup, health verification, and completion summary to install.sh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 21:39:54 -05:00
Alex Newman f7fea1f779 MAESTRO: add interactive AI provider setup and settings writer to install.sh
Add setup_ai_provider() with 3-option menu (Claude Max/Gemini/OpenRouter),
mask_api_key() for secure terminal display, and write_settings() that generates
~/.claude-mem/settings.json with all 35 defaults from SettingsDefaultsManager.ts
in flat JSON schema. Preserves existing user customizations on re-run.
23 new tests added (46/46 total pass). Passes bash -n and shellcheck clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 21:35:40 -05:00
Alex Newman 1f834863a7 MAESTRO: add OpenClaw gateway detection, plugin install, and memory slot config to install.sh
Add find_openclaw()/check_openclaw() for gateway detection across PATH,
~/.openclaw/, /usr/local/bin/, and node_modules paths. Add install_plugin()
that clones, builds, creates installable package, and runs plugins install/enable
following the Dockerfile.e2e flow. Add configure_memory_slot() that creates or
updates ~/.openclaw/openclaw.json with plugins.slots.memory="claude-mem" while
preserving existing config. Includes test-install.sh with 23 passing tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 21:31:15 -05:00
Alex Newman e4846a2046 MAESTRO: add openclaw/install.sh script foundation with banner, platform detection, and dependency management
Creates the core installer script with:
- ASCII banner and ANSI color utility functions (info/success/warn/error/prompt_user)
- Automatic terminal color support detection
- Platform detection (macOS, Linux, WSL, Windows/MINGW)
- Bun detection, version checking (>=1.1.14), and auto-installation
- uv detection and auto-installation
- find_bun_path() helper returning full path to bun binary
- --non-interactive flag for curl|bash piping safety
- All dependency patterns translated from plugin/scripts/smart-install.js

Passes bash -n syntax check and shellcheck with zero warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 21:27:29 -05:00
Glucksberg 63827c9dcb fix: type ObservationSSEPayload.project as nullable
The project field can be null/undefined for malformed SSE payloads.
Update the type and getSourceLabel signature to match the runtime
null guard.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 03:17:32 +00:00
Glucksberg 809175612c feat(openclaw): enable observation feed for OpenClaw agent sessions
Three fixes to make OpenClaw agent observations work end-to-end:

1. Session init in before_agent_start — the worker's privacy check
   requires a stored user prompt; without calling /api/sessions/init,
   all observations were skipped as "private"

2. Race condition fix in agent_end — await summarize before sending
   complete, preventing session deletion before in-flight observation
   POSTs arrive

3. OAuth token pass-through in buildIsolatedEnv — spawned Claude CLI
   processes now receive CLAUDE_CODE_OAUTH_TOKEN from the worker's
   env when no explicit API key is configured

Also adds agent-specific emoji mapping and dynamic project naming
for the Telegram observation feed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 02:30:18 +00:00
Alex Newman 05b615c858 Fix SSE stream URL consistency, multi-line data parsing, and test mocks
- Use workerBaseUrl() for SSE stream URL instead of hardcoded localhost
- Concatenate all SSE data: lines per frame per SSE spec
- Update WhatsApp mock to accept third options argument
- Restrict SSE mock server to only respond on /stream path

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 21:54:02 -05:00
Alex Newman e13562e4cb Clean up session tracking on session_end to prevent unbounded map growth
gateway_start only fires on full process restart. Without cleanup,
sessionIds and workspaceDirsBySessionKey grow indefinitely across
/new and /reset cycles. session_end now deletes entries for the
completed session key.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 21:42:23 -05:00
Alex Newman c7f7f87321 Move session init to session_start and after_compaction hooks
Init was incorrectly placed in before_agent_start, which fires on every
agent attempt (retries, context overflow, auth rotation). Session init
should fire once on /new or /reset (session_start) and after compaction
(after_compaction). before_agent_start now only syncs MEMORY.md and
tracks workspace dirs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 21:04:52 -05:00
Alex Newman 11532a36fb Fix sendToChannel to use explicit OpenClaw SDK function mapping
Replace dynamic function name construction with CHANNEL_SEND_MAP that
matches the actual PluginRuntime.channel structure. Fixes WhatsApp
(sendMessageWhatsApp) and iMessage (sendMessageIMessage) casing, and
adds WhatsApp's required verbose option. Also adds null guard on SSE
observation payload before type casting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 20:14:41 -05:00
Alex Newman 121f673328 MAESTRO: Rewrite SKILL.md with correct worker setup flow
The worker doesn't require a Claude Code installation. Rewrite setup
to: clone repo first, check if worker is already running (from existing
Claude Code install), start from Claude Code install if available, or
start from cloned repo as fallback. Each path includes health check
verification and debug steps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 19:29:00 -05:00
Alex Newman f5b69df11a MAESTRO: Add comprehensive SKILL.md for end-to-end OpenClaw plugin setup
Complete setup guide covering prerequisites, plugin configuration,
observation recording verification, observation feed setup with
per-channel instructions (Telegram, Discord, Slack, Signal, WhatsApp,
LINE), command reference, architecture overview, and troubleshooting.
Written for bots to walk users through the full setup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 19:20:59 -05:00
Alex Newman 7b7a92e35a MAESTRO: Add observation I/O, MEMORY.md live sync, and gateway lifecycle support
Merge crab-mem observation recording with existing SSE broadcasting to
create a complete OpenClaw plugin. Records observations from embedded
runner sessions via worker HTTP API, and continuously syncs MEMORY.md
to agent workspaces so agents always have fresh context.

- Add event handlers: before_agent_start, tool_result_persist, agent_end, gateway_start
- Add MEMORY.md live sync on every agent start and tool use (fire-and-forget)
- Add worker HTTP client (POST, fire-and-forget POST, GET text)
- Add /claude-mem-status health check command
- Add workspace dir tracking across session events
- Expand test suite from 17 to 36 tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 19:12:12 -05:00
Alex Newman 33ab7ba747 MAESTRO: Add Docker E2E test against real OpenClaw gateway
Installs plugin on ghcr.io/openclaw/openclaw:main via `plugins install`,
starts mock worker + gateway, and verifies 16 checks (discovery, files,
SSE connectivity, gateway plugin load). Includes interactive mode for
human manual testing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 21:28:16 -05:00
Alex Newman 1b9f601c41 MAESTRO: Fix OpenClaw SDK API mismatch — use real PluginApi interface
E2E testing against the official OpenClaw Docker image revealed the plugin
was built against a custom interface that didn't match the real SDK:
- api.log() → api.logger.info/warn/error() (PluginLogger interface)
- api.getConfig() → api.pluginConfig (direct property)
- command handler (args[], ctx) → (ctx) with ctx.args string
- service stop optional, service context typed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 21:28:08 -05:00
Alex Newman db207807cb MAESTRO: Address PR review feedback — fix connection lifecycle, lazy channel access, buffer safety
- Move sseAbortController/connectionState from module globals into closure for multi-instance safety
- Make start() idempotent by aborting existing connection before creating a new one
- Track connectionPromise and await it on stop() for proper cleanup
- Guard channel API access lazily to prevent crash when integrations are missing
- Add 1MB MAX_SSE_BUFFER_SIZE to prevent unbounded buffer growth
- Log malformed JSON parse errors instead of silently ignoring
- Replace error: any with proper instanceof Error type narrowing
- Remove hardcoded user paths from TESTING.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 20:06:29 -05:00
Alex Newman f1ecf5bc68 MAESTRO: Add manual E2E testing checklist for OpenClaw plugin verification
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 18:52:38 -05:00
Alex Newman 719079581a MAESTRO: Add smoke test script for OpenClaw plugin registration validation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 18:49:47 -05:00
Alex Newman f8d8de53e8 MAESTRO: Implement SSE observation feed consumer with channel routing and exponential backoff
Replaces stub start/stop methods with working SSE consumer that connects to
claude-mem worker's /stream endpoint, parses new_observation events, and
forwards formatted messages to configured OpenClaw channels (Telegram, Discord,
Signal, Slack, WhatsApp, Line). Includes reconnection with exponential backoff
(1s-30s), connection state tracking, and on/off command toggle. Added 17 tests
covering unit and SSE integration scenarios.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 18:44:35 -05:00
Alex Newman baa37eba07 MAESTRO: Add OpenClaw plugin entry point with service and command registration
Creates openclaw/src/index.ts with:
- Inline OpenClawPluginApi interface definition
- registerService for claude-mem-observation-feed (stub start/stop for Phase 2)
- registerCommand for /claude-mem-feed status command
- Plugin initialization logging

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 18:37:49 -05:00
Alex Newman 8933343433 MAESTRO: Add OpenClaw plugin scaffold with configuration files
Create openclaw/ directory with plugin manifest (openclaw.plugin.json),
package.json, tsconfig.json, and .gitignore. Plugin manifest includes
full configSchema with observationFeed settings for live streaming
observations to messaging channels.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 18:36:20 -05:00