Commit Graph

1295 Commits

Author SHA1 Message Date
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
Alex Newman 0dda593c45 docs: update CHANGELOG.md for v10.0.3 2026-02-11 15:45:25 -05:00
Alex Newman 1bfb473c19 chore: bump version to 10.0.3 v10.0.3 2026-02-11 15:44:45 -05:00
Alex Newman 3f01baebfe Merge remote-tracking branch 'origin/main' into fix/chroma-mcp-spawn-storm
# Conflicts:
#	src/services/worker-service.ts
#	tests/infrastructure/process-manager.test.ts
2026-02-11 15:43:08 -05:00
Alex Newman 46b61857ab docs: update CHANGELOG.md for v10.0.2
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 15:26:31 -05:00
Alex Newman 0b214a59a1 chore: bump version to 10.0.2
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
v10.0.2
2026-02-11 15:25:50 -05:00
Alex Newman 77579669f2 Merge pull request #1056 from rodboev/fix/hook-resilience-worker-lifecycle
fix: hook resilience and worker lifecycle — 87% faster recovery from dead worker
2026-02-11 15:16:06 -05:00
Rod Boev 2c5c99c0c7 fix: use etime-based sorting instead of PID ordering for process guards
Addresses Greptile review feedback:
- ChromaSync: replace PID-based sort with ps etime column + parseElapsedTime()
  for reliable age ordering (PIDs wrap and don't guarantee ordering)
- ProcessManager: filter out entries with unparseable etime (-1) before
  sorting to prevent sort corruption in cleanupExcessChromaProcesses()
2026-02-11 07:19:28 -05:00
Rod Boev a3f9e7f638 fix: prevent chroma-mcp spawn storm with 5-layer defense (641 processes → max 2)
During SIGHUP testing with 6+ active sessions, ChromaSync.ensureConnection()
had no mutex — concurrent fire-and-forget syncObservation() calls each spawned
a chroma-mcp subprocess via StdioClientTransport, creating 641 orphans in ~5min.
Error-driven reconnection formed a positive feedback loop amplifying the storm.

Defense layers:
- Layer 0: Connection mutex via promise memoization (prevents concurrent spawns)
- Layer 1: Pre-spawn process count guard using execFileSync('ps') (kills excess)
- Layer 2: Hardened close() with try-finally + Unix pkill in GracefulShutdown
- Layer 3: Count-based orphan reaper in ProcessManager (not age-based)
- Layer 4: Circuit breaker stops retries after 3 consecutive failures for 60s

Closes #1063, closes #695
Relates to #1010, #707
2026-02-11 07:19:28 -05:00
Rod Boev 4e67393d27 fix: prevent daemon silent death from SIGHUP + unhandled errors
Root cause: registerSignalHandlers() handled SIGTERM/SIGINT but not
SIGHUP. When the parent hook process exits, the kernel sends SIGHUP
to the daemon, causing immediate termination (default signal action).

Belt-and-suspenders fix:
1. SIGHUP handler: ignore in daemon mode, graceful shutdown otherwise
2. setsid: spawn daemon in new session on Linux (prevents SIGHUP delivery)
3. Global unhandledRejection/uncaughtException guards in daemon mode
2026-02-11 00:35:53 -05:00
Alex Newman cb0933a908 fix: resolve merge conflict in isWorkerUnavailableError
Missing return statement and closing brace in the programming errors
check caused a build failure after merging main.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 23:47:46 -05:00
Alex Newman af95461a70 Merge branch 'main' into fix/hook-resilience-worker-lifecycle
# Conflicts:
#	plugin/scripts/mcp-server.cjs
#	plugin/scripts/worker-service.cjs
2026-02-10 23:37:33 -05:00
Alex Newman 79b3a61ac8 docs: update CHANGELOG.md for v10.0.1
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:31:20 -05:00
Alex Newman a9e3b659d3 chore: bump version to 10.0.1
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
v10.0.1
2026-02-10 22:30:52 -05:00
Alex Newman af9584a174 Merge pull request #1059 from Glucksberg/feat/openclaw-observation-feed
feat(openclaw): enable observation feed for OpenClaw agent sessions
2026-02-10 22:29:28 -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 06d9ef24f1 docs: update CHANGELOG.md for v10.0.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 19:38:29 -05:00
Alex Newman f37a1fd6dc chore: bump version to 10.0.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
v10.0.0
2026-02-10 19:37:31 -05:00
Alex Newman badcd0e0be Merge pull request #1057 from thedotmack/fix/windows-platform-improvements-v2
fix: Windows platform improvements — re-enable Chroma, migrate WMIC, simplify env isolation
2026-02-10 19:34:00 -05:00
Rod Boev 22683f6910 fix: clarify TypeError order dependency in error classifier
Address Greptile review: add comment noting that TypeError('fetch failed')
is already handled by transport patterns before the instanceof check.
2026-02-10 17:50:47 -05:00
Rod Boev 7ffa1b06ee Clarify order dependency
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-10 17:36:13 -05:00
Rod Boev 418e38ee46 fix: hook resilience and worker lifecycle improvements (#957, #923, #984, #987, #1042)
Reduce timeouts to eliminate 10-30s startup delay when worker is dead
(common on WSL2 after hibernate). Add stale PID detection, graceful
error handling across all handlers, and error classification that
distinguishes worker unavailability from handler bugs.

- HEALTH_CHECK 30s→3s, new POST_SPAWN_WAIT (5s), PORT_IN_USE_WAIT (3s)
- isProcessAlive() with EPERM handling, cleanStalePidFile()
- getPluginVersion() try-catch for shutdown race (#1042)
- isWorkerUnavailableError: transport+5xx+429→exit 0, 4xx→exit 2
- No-op handler for unknown event types (#984)
- Wrap all handler fetch calls in try-catch for graceful degradation
- CLAUDE_MEM_HEALTH_TIMEOUT_MS env var override with validation
2026-02-10 15:34:35 -05:00
Rod Boev 6ac5507e4e fix: address review feedback on statusline-counts.js
- Check CLAUDE_MEM_DATA_DIR env var before settings.json (Greptile)
- Derive project before DB check for consistent output (Greptile)
- Include project in error fallback output (Greptile)
- Set executable permission for shebang compatibility (Greptile)
2026-02-10 04:39:58 -05:00
Rod Boev 9bcef1774d feat: add project-scoped statusline counter utility
Lightweight script for Claude Code statusLineCommand integration.
Returns per-project observation and prompt counts via direct SQLite
read (~15ms, no HTTP, no worker dependency).

Counts are scoped with WHERE project = ? to prevent inflated totals
from cross-project observations. Supports CLAUDE_MEM_DATA_DIR from
settings.json for custom data directory configurations.
2026-02-10 04:15:27 -05:00
Alex Newman edecfdb5bc Remove PLAN.md as it is no longer needed 2026-02-09 22:06:09 -05:00
Alex Newman 74670c00a6 Remove Auto Run Docs from git tracking
These files were committed before the gitignore rule was added.
Removes 29 tracked files and adds Auto Run Docs/ to .gitignore.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 22:03:06 -05:00
Alex Newman bd9b02f364 Merge pull request #1012 from thedotmack/openclaw-plugin
Official OpenClaw plugin for Claude-Mem
2026-02-09 22:00:05 -05: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 7cc27d45a4 MAESTRO: Add observation feed setup guide to OpenClaw docs
Step-by-step instructions for configuring the observation feed to
stream to Telegram, Discord, Slack, Signal, WhatsApp, and LINE
channels. Includes per-channel target ID discovery, verification
steps, and troubleshooting table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 19:16:32 -05:00
Alex Newman 9c20f4142c MAESTRO: Add OpenClaw integration documentation
Document the complete OpenClaw plugin architecture including observation
recording, MEMORY.md live sync, SSE observation feeds, configuration
options, and commands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 19:13:38 -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 b2ddf59db4 MAESTRO: Add comprehensive PR triage report for 27 open PRs in claude-mem repository
Categorized all 27 open PRs into 9 groups (Owner, Security, Critical Bug Fixes,
Windows, Features, Infrastructure, Documentation, Other) with MERGE/REVIEW/CLOSE/DEFER
recommendations. 19 REVIEW, 5 CLOSE, 5 DEFER. Identified key coordination clusters
for security fixes, subprocess management, and session ID handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 21:04:32 -05:00
Alex Newman a0d737ba51 MAESTRO: Add Critical & High-Priority Issues triage report
Categorized 17 open issues into Tier 1 (Critical Security & Stability)
and Tier 2 (High-Priority Bug Fixes) with KEEP/DISCARD/DEFER
recommendations for each. Cross-referenced 6 issues to active PRs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 20:55:14 -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 1d090b33f5 MAESTRO: Mark session/search issue triage task complete in ISSUE-TRIAGE-09.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:38:40 -05:00
Alex Newman 700aae8a31 MAESTRO: Triage 8 worker/database issues in Phase 09 (#1011, #998, #979, #966, #916, #911, #855, #740)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:35:37 -05:00
Alex Newman fbdff0b178 MAESTRO: Mark Issue Triage Phase 06 Task 2 complete - Windows bug triage
Triaged 8 remaining Windows-specific bugs: labeled 5 issues (priority
high/medium/low), closed 2 as duplicate/vague, closed 1 fix proposal
with PR guidance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:27:41 -05:00
Alex Newman 018549c3c7 MAESTRO: Verify all 37 duplicate issue closures in Phase 04 triage
Confirmed all duplicate issues across 6 clusters (CLAUDE.md pollution,
FOLDER_CLAUDEMD_ENABLED, orphaned processes, Windows popups, Zod schema,
SessionStart exit code) are successfully closed on GitHub.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:20:53 -05:00
Alex Newman 63e8755be5 MAESTRO: Close issue #976 as duplicate of #975 (Zod cyclical schema cluster)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:19:08 -05:00
Alex Newman c8aaa79ab6 MAESTRO: Close 5 remaining stale/fixed issues in Phase 03 triage (#591, #626, #582, #815, #948)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:12:52 -05:00
Alex Newman 194e44f52a MAESTRO: Close support/help and wrong-product issues (#633, #759, #880, #678)
Phase 02 issue triage - closed 4 non-bug issues with helpful responses:
- #633: Cursor install support question
- #759: Wrong product (VS Code != Claude Code)
- #880: Self-resolved installation issue
- #678: Resolution note, not a bug report

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:09:38 -05:00
Alex Newman efd47a9586 MAESTRO: Close 5 junk/spam/troll issues (#971, #925, #893, #878, #881) in Phase 01 triage
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:07:48 -05:00