feat: add remote worker architecture (#69) #70

Merged
jack merged 2 commits from feat/remote-worker-69 into main 2026-01-22 16:03:25 +00:00
Owner

Summary

  • Add support for running the worker remotely (Docker/Cloud deployment) while hooks run locally
  • Bearer token authentication middleware for secure remote connections
  • Rate limiting middleware (1000 req/min) for remote requests
  • Type-safe implementation with dedicated types in src/types/remote/
  • All hook handlers updated to support local/remote mode switching

New Settings

Setting Default Description
CLAUDE_MEM_REMOTE_MODE false Enable remote worker mode
CLAUDE_MEM_REMOTE_URL "" Remote worker URL (e.g., https://claude-mem.example.com)
CLAUDE_MEM_REMOTE_TOKEN "" Bearer token for authentication
CLAUDE_MEM_REMOTE_VERIFY_SSL true Verify SSL certificates
CLAUDE_MEM_REMOTE_TIMEOUT_MS "30000" Request timeout in milliseconds

Files Changed

New files:

  • src/types/remote/ - Type definitions (config, auth, responses)
  • src/shared/remote-config.ts - Remote config loading with caching
  • src/shared/remote-endpoint.ts - Endpoint configuration
  • src/shared/fetch-with-auth.ts - Authenticated fetch wrapper
  • src/services/server/middleware/ - Auth and rate limit middleware

Modified files:

  • src/shared/SettingsDefaultsManager.ts - Added remote settings
  • src/cli/handlers/*.ts - Remote/local mode support
  • src/services/server/Server.ts - Middleware integration

Bug Fix

Also fixes pre-existing "Database not initialized" error on worker startup by changing TagRoutes to use lazy getSessionStore() via DatabaseManager.

Test plan

  • Local mode works as before (default)
  • Remote mode with valid token authenticates successfully
  • Remote mode without token returns 401
  • Rate limiting blocks excessive requests

Closes #69

🤖 Generated with Claude Code

## Summary - Add support for running the worker remotely (Docker/Cloud deployment) while hooks run locally - Bearer token authentication middleware for secure remote connections - Rate limiting middleware (1000 req/min) for remote requests - Type-safe implementation with dedicated types in `src/types/remote/` - All hook handlers updated to support local/remote mode switching ## New Settings | Setting | Default | Description | |---------|---------|-------------| | `CLAUDE_MEM_REMOTE_MODE` | `false` | Enable remote worker mode | | `CLAUDE_MEM_REMOTE_URL` | `""` | Remote worker URL (e.g., `https://claude-mem.example.com`) | | `CLAUDE_MEM_REMOTE_TOKEN` | `""` | Bearer token for authentication | | `CLAUDE_MEM_REMOTE_VERIFY_SSL` | `true` | Verify SSL certificates | | `CLAUDE_MEM_REMOTE_TIMEOUT_MS` | `"30000"` | Request timeout in milliseconds | ## Files Changed **New files:** - `src/types/remote/` - Type definitions (config, auth, responses) - `src/shared/remote-config.ts` - Remote config loading with caching - `src/shared/remote-endpoint.ts` - Endpoint configuration - `src/shared/fetch-with-auth.ts` - Authenticated fetch wrapper - `src/services/server/middleware/` - Auth and rate limit middleware **Modified files:** - `src/shared/SettingsDefaultsManager.ts` - Added remote settings - `src/cli/handlers/*.ts` - Remote/local mode support - `src/services/server/Server.ts` - Middleware integration ## Bug Fix Also fixes pre-existing "Database not initialized" error on worker startup by changing `TagRoutes` to use lazy `getSessionStore()` via `DatabaseManager`. ## Test plan - [ ] Local mode works as before (default) - [ ] Remote mode with valid token authenticates successfully - [ ] Remote mode without token returns 401 - [ ] Rate limiting blocks excessive requests Closes #69 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat: add remote worker architecture (#69)
All checks were successful
CI / build (pull_request) Successful in 20s
CI / validate-plugin (pull_request) Successful in 2s
4f849ab2b0
Add support for running the worker remotely (Docker/Cloud deployment) while
hooks run locally. Includes:

- Type definitions for remote config, auth, and responses (src/types/remote/)
- Remote endpoint configuration with local/remote mode switching
- Bearer token authentication middleware for remote connections
- Rate limiting middleware for remote requests (1000 req/min)
- Authenticated fetch wrapper with retry support
- Settings: CLAUDE_MEM_REMOTE_MODE, REMOTE_URL, REMOTE_TOKEN, etc.
- Updated all hook handlers to support remote/local mode

Also fixes: "Database not initialized" error on worker startup by changing
TagRoutes to use lazy getSessionStore() via DatabaseManager.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Merge branch 'main' into feat/remote-worker-69
All checks were successful
CI / build (pull_request) Successful in 20s
CI / validate-plugin (pull_request) Successful in 2s
6341bd7bd3
jack merged commit 4d939e4304 into main 2026-01-22 16:03:25 +00:00
Sign in to join this conversation.
No description provided.