claude-mpm 5.10.14 → 5.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +100 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -315,6 +315,106 @@ claude-mpm cleanup-memory
315
315
 
316
316
  ---
317
317
 
318
+ ## SDK Runtime Mode (Experimental)
319
+
320
+ **New in v5.11.0** -- Claude MPM can now run the PM agent via the [Claude Agent SDK](https://docs.anthropic.com/en/docs/claude-code/sdk) instead of spawning a CLI subprocess. This enables programmatic control, real-time event streaming, and live session observability.
321
+
322
+ > **Backward Compatible**: The default runtime is still CLI mode. Existing users do not need to change anything.
323
+
324
+ ### Enabling SDK Mode
325
+
326
+ ```bash
327
+ # Via CLI flag
328
+ claude-mpm run --sdk
329
+
330
+ # Via environment variable
331
+ export CLAUDE_MPM_RUNTIME=sdk
332
+ claude-mpm run
333
+
334
+ # Force CLI mode explicitly (useful to override auto-detection)
335
+ claude-mpm run --cli
336
+ ```
337
+
338
+ **Auto-detection**: If the `claude-agent-sdk` Python package is installed and no flag or env var is set, SDK mode is selected automatically. Otherwise, CLI mode is used as the fallback.
339
+
340
+ ### New CLI Flags
341
+
342
+ | Flag | Description |
343
+ |------|-------------|
344
+ | `--sdk` | Use Agent SDK runtime (requires `claude-agent-sdk`) |
345
+ | `--cli` | Force CLI subprocess runtime |
346
+ | `--inject-port <PORT>` | Start message injection endpoint on PORT (default: 7856) |
347
+
348
+ **Environment variable**: `CLAUDE_MPM_RUNTIME=sdk` or `CLAUDE_MPM_RUNTIME=cli`
349
+
350
+ ### Key Capabilities
351
+
352
+ **Monitor Agent** -- A background watchdog thread that monitors PM session health:
353
+ - Context pressure warnings at configurable thresholds (70%, 80%, 90%, 95%)
354
+ - Session duration and idle/stuck detection
355
+ - Automatic warnings injected via the hook event bus
356
+
357
+ **Message Injection** -- External systems can send prompts to the running PM session:
358
+ ```bash
359
+ # Start the injection endpoint
360
+ claude-mpm run --sdk --inject-port 7856
361
+
362
+ # From another terminal or script
363
+ curl -X POST http://localhost:7856/inject \
364
+ -H "Content-Type: application/json" \
365
+ -d '{"prompt": "Check the status of PR #123"}'
366
+ ```
367
+
368
+ The `/mpm-message` slash command also bridges messages to the PM session via the monitor agent's `systemMessage` channel.
369
+
370
+ **Session Observability** -- Live session state and activity feed via HTTP:
371
+ ```bash
372
+ # Current session state (idle, processing, tool_call, etc.)
373
+ curl http://localhost:7856/session
374
+
375
+ # Recent activity feed
376
+ curl http://localhost:7856/activity
377
+ ```
378
+
379
+ ### Architecture Overview
380
+
381
+ The SDK runtime is built on an adapter pattern with clean separation of concerns:
382
+
383
+ - **`AgentRuntime` ABC** -- Runtime-agnostic interface with `run()`, `resume()`, `fork()`, and `run_with_hooks()` methods
384
+ - **`SDKAgentRunner`** -- In-process SDK implementation using `claude-agent-sdk`
385
+ - **`CLIAgentRunner`** -- Subprocess adapter wrapping the existing `ClaudeAdapter`
386
+ - **`create_runtime()` factory** -- Instantiates the correct backend based on config
387
+ - **`RuntimeConfig`** -- Resolves runtime type from `CLAUDE_MPM_RUNTIME` env var or auto-detection
388
+ - **`HookEventBus`** -- File-based message queue for sidecar agent to PM communication
389
+ - **`SDKEventBridge`** -- Translates SDK events into MPM monitoring dashboard emissions
390
+ - **`SessionStateTracker`** -- Thread-safe state machine for session observability
391
+
392
+ ```
393
+ ┌─────────────────┐
394
+ │ create_runtime │
395
+ └────────┬────────┘
396
+
397
+ ┌────────────┴────────────┐
398
+ │ │
399
+ ┌────────▼────────┐ ┌────────▼────────┐
400
+ │ SDKAgentRunner │ │ CLIAgentRunner │
401
+ │ (in-process) │ │ (subprocess) │
402
+ └────────┬────────┘ └─────────────────┘
403
+
404
+ ┌──────────┼──────────┐
405
+ │ │ │
406
+ ▼ ▼ ▼
407
+ Monitor EventBridge StateTracker
408
+ Agent (SocketIO) (/session)
409
+ ```
410
+
411
+ ### Requirements
412
+
413
+ - **`claude-agent-sdk`** Python package (optional -- only needed for SDK mode)
414
+ - SDK mode is experimental and may change in future releases
415
+
416
+ ---
417
+
318
418
  ## What's New in v5.9.46
319
419
 
320
420
  ### Near-Instant Startup (Daily Sync)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-mpm",
3
- "version": "5.10.14",
3
+ "version": "5.11.0",
4
4
  "description": "NPM wrapper for claude-mpm Python package - Requires Python 3.8+. Orchestrate Claude with agent delegation and ticket tracking",
5
5
  "keywords": [
6
6
  "claude",