Commit Graph

1256 Commits

Author SHA1 Message Date
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 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
Alex Newman dac989c697 docs: update CHANGELOG.md for v9.1.1
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 02:19:20 -05:00
Alex Newman 5969d670d0 chore: bump version to 9.1.1
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
v9.1.1
2026-02-07 02:18:44 -05:00
Alex Newman 39990f2818 docs: update CHANGELOG.md for v9.1.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 01:07:00 -05:00
Alex Newman 8dfcb5e612 chore: bump version to 9.1.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
v9.1.0
2026-02-07 01:05:38 -05:00
Alex Newman 4d91053f8c MAESTRO: Mark PR #657 merge complete in PR-Triage-12.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 05:53:33 -05:00
Alex Newman ff503d08a7 MAESTRO: Merge PR #657 - Add generate/clean CLI commands for CLAUDE.md management
Cherry-picked source changes from PR #657 (224 commits behind main).
Adds `claude-mem generate` and `claude-mem clean` CLI commands:
- New src/cli/claude-md-commands.ts with generateClaudeMd() and cleanClaudeMd()
- Worker service generate/clean case handlers with --dry-run support
- CLAUDE_MD logger component type
- Uses shared isDirectChild from path-utils.ts (DRY improvement over PR original)

Skipped from PR: 91 CLAUDE.md file deletions (stale), build artifacts,
.claude/plans/ dev artifact, smart-install.js shell alias auto-injection
(aggressive profile modification without consent).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 05:52:54 -05:00
Alex Newman 0ee8c00c5f MAESTRO: Merge PR #863 - Ragtime email investigation batch processor
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 05:42:15 -05:00
Alex Newman d4e122a1f8 Merge pull request #863 from thedotmack/claude/setup-ragtime-epstein-analysis-JApkL
feat: implement ragtime email investigation with self-iteration and cleanup
2026-02-06 05:41:54 -05:00
Alex Newman 5508194189 MAESTRO: Close PR #854 - Pro cloud sync premature, hold for when backend is live
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 05:40:43 -05:00
Alex Newman ded11645e3 MAESTRO: Mark PR #968 evaluation complete - already closed by author
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 05:25:49 -05:00
Alex Newman 7afbba4c3f MAESTRO: Close PR #660 - Network mode bundles documentation deletions and unrelated features
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 05:24:54 -05:00
Alex Newman bf439043cf MAESTRO: Merge PRs #920 and #699 - Add project exclusion and folder CLAUDE.md exclusion settings
Cherry-picked both PRs to main (both had merge conflicts with current main).

PR #920 (@Spunky84): CLAUDE_MEM_EXCLUDED_PROJECTS setting with glob patterns
to exclude entire projects from memory tracking (privacy/confidentiality).
Early-exit in session-init and observation handlers. 11 unit tests.

PR #699 (@leepokai): CLAUDE_MEM_FOLDER_MD_EXCLUDE setting with JSON array
of paths to exclude from CLAUDE.md file generation (fixes SwiftUI/Xcode
build conflicts and drizzle kit migration failures). Closes #620.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 05:23:01 -05:00
Alex Newman 24ce746b91 MAESTRO: Mark PR #662 evaluation complete in triage document 2026-02-06 04:14:14 -05:00
Alex Newman 98920bd860 MAESTRO: Merge PR #662 - Add save_memory MCP tool for manual memory storage
Adds save_memory MCP tool allowing users to manually save observations
for semantic search. Source changes cherry-picked from PR #662 by
@darconada (build artifact conflicts resolved by direct application).

Closes #645.

Co-Authored-By: darconadalabarga <darconada@arsys.es>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 04:13:44 -05:00
Alex Newman fbcbdfca62 MAESTRO: Close PR #860 - Clawdbot detection is dead code with no user demand
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:45:45 -05:00
Alex Newman 6ae8890092 MAESTRO: Close PR #746 - OpenCode platform adapter needs clean resubmission
Core adapter code is sound but PR includes build artifacts, planning docs,
and settings changes. Requested focused re-submission with source-only changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:44:46 -05:00
Alex Newman c113e23001 MAESTRO: Close PR #680 - multi-model OpenRouter fallback bundles too many features and deletes docs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:43:16 -05:00
Alex Newman b58a61c0b3 MAESTRO: Close PR #644 - OpenAI provider duplicates OpenRouter coverage
OpenAI models are already accessible via OpenRouter. The proposed 491-line
OpenAIAgent duplicates the existing OpenAI-compatible API in OpenRouterAgent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:41:43 -05:00
Alex Newman 936080d710 MAESTRO: Close PR #786 - GLM provider has process.env concurrency bug and YAGNI preset
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:28:29 -05:00
Alex Newman 10675f7125 MAESTRO: Close PR #808 - direct Anthropic API provider duplicates SDK path
Memory concerns addressed by PR #806. Two Anthropic providers would create
confusion and maintenance overhead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:25:13 -05:00
Alex Newman 39e4aa1976 MAESTRO: Mark PR #844 complete in PR-Triage-11 - session-complete hook cherry-picked
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:24:00 -05:00
Alex Newman 5dffb1ebb0 MAESTRO: fix(hooks): add session-complete handler to enable orphan reaper cleanup
Cherry-picked from PR #844 by @thusdigital. Sessions stayed in active
sessions map forever after summarize, causing the orphan reaper to think
all processes were still active. Adds session-complete as Stop phase 2
hook that calls POST /api/sessions/complete to remove sessions from the
active map, allowing the reaper to correctly identify and clean up
orphaned worker processes. Fixes #842.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:23:13 -05:00
Alex Newman 56df2c45e5 MAESTRO: Close PR #833 as stale - PRAGMA foreign_keys unnecessary for cleanup script
observations table has no children; FK constraints addressed in v8.5.6 (PR #889)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:19:06 -05:00
Alex Newman 4c719d776a MAESTRO: Mark PR #889 complete in PR-Triage-11 - FK constraint fix cherry-picked
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:16:50 -05:00
Alex Newman da1d2cd36a MAESTRO: fix(db): prevent FK constraint failures on worker restart
Cherry-picked source changes from PR #889 by @Et9797. Fixes #846.

Key changes:
- Add ensureMemorySessionIdRegistered() guard in SessionStore.ts
- Add ON UPDATE CASCADE migration (schema v21) for observations and session_summaries FK constraints
- Change message queue from claim-and-delete to claim-confirm pattern (PendingMessageStore.ts)
- Add spawn deduplication and unrecoverable error detection in SessionRoutes.ts and worker-service.ts
- Add forceInit flag to SDKAgent for stale session recovery

Build artifacts skipped (pre-existing dompurify dep issue). Path fixes (HealthMonitor.ts, worker-utils.ts)
already merged via PR #634.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:16:17 -05:00
Alex Newman 7ed1e576b2 MAESTRO: Mark PR #721 complete in PR-Triage-11 - Cursor bun runtime fix cherry-picked
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:10:01 -05:00
Alex Newman 8030c44af4 MAESTRO: fix(cursor): use bun runtime and fix hooks directory detection
Cherry-picked source changes from PR #721. Fixes two Cursor standalone
setup bugs:

1. findCursorHooksDir() now checks for hooks.json (unified CLI mode)
   in addition to legacy common.sh/common.ps1 scripts
2. installCursorHooks() now uses bun instead of node for hook commands
   since worker-service.cjs depends on bun:sqlite
3. Added findBunPath() to detect bun executable across platforms

Build artifacts skipped (pre-existing dompurify viewer dep issue).
Source-only cherry-pick, TypeScript compilation clean for modified file.

Co-Authored-By: polux0 <aleksaprosperitylabs@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:09:26 -05:00
Alex Newman 2f935a56b9 MAESTRO: Mark PR #771 complete in PR-Triage-11 - stdin hang fix merged
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:06:38 -05:00
Claude 830d7a2b23 fix: detect complete JSON instead of waiting for EOF
Root cause: Claude Code doesn't close stdin after writing hook input,
so stdin.on('end') never fires.

Previous approach: Timeout-based workaround (wait 5s then parse).

New approach: JSON is self-delimiting. We attempt to parse after each
data chunk. Once we have valid JSON, we resolve immediately without
waiting for EOF. This is the proper fix - hooks now exit in <500ms
instead of waiting for any timeout.

Changes:
- Add tryParseJson() to detect complete JSON
- Parse after each stdin chunk, resolve immediately on success
- Add 50ms parse delay for multi-chunk delivery edge case
- Safety timeout (30s) only for truly malformed input
- Removes dependency on stdin.on('end') which never fires

Testing:
- Normal operation: 448ms (was 5000ms+ with timeout approach)
- Stdin stays open: Process exits immediately after JSON complete

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 03:06:03 -05:00
Claude 5cbe0a38ca fix: address code review feedback
- Change from absolute timeout to inactivity timeout (reset on each data chunk)
  to avoid truncating large/slow payloads
- Fix race condition: add resolved=true before resolving in catch block
- Fix unreliable readable check: just access the property, don't check value
- Add cleanup() call in catch block for consistency

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 03:06:03 -05:00
Claude c477ded1b5 fix: handle stdin unavailability and timeout to prevent hook hangs
Fixes #727 (PostToolUse hooks hanging at "1/2 done")
Addresses #646 (Bun stdin EINVAL crash)

Root causes:
1. Bun crashes with EINVAL when Claude Code doesn't provide valid stdin fd
2. stdin.on('end') never fires if Claude Code doesn't close stdin properly

Changes:
- Add isStdinAvailable() to safely check stdin before reading
- Wrap stdin access in try-catch to handle Bun's lazy fstat crash
- Add 5-second timeout to prevent indefinite hangs
- Gracefully return undefined instead of crashing on stdin errors
- Properly clean up event listeners to prevent memory leaks

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 03:06:03 -05:00
Alex Newman 3040ea8a97 MAESTRO: Mark PR #524 complete in PR-Triage-11 - minimum bun version check merged
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 03:04:59 -05:00
quicktime 9ad640a5c4 fix: add minimum bun version check to smart-install.js
Bun 1.1.14+ is required because:
- `.changes` property on SQLite statements (added in 1.1.14)
- Multi-statement SQL support in db.run() (fixed in 1.0.26)

Older versions cause silent failures in database migrations.

Fixes #519

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 03:04:32 -05:00