claude-tempo 0.9.0 → 0.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 (74) hide show
  1. package/CLAUDE.md +125 -96
  2. package/LICENSE +21 -0
  3. package/README.md +695 -602
  4. package/assets/icon-dark.svg +9 -9
  5. package/assets/icon.svg +9 -9
  6. package/assets/logo-dark.svg +11 -11
  7. package/assets/logo-light.svg +11 -11
  8. package/dist/activities/outbox.d.ts +5 -3
  9. package/dist/activities/outbox.js +28 -24
  10. package/dist/activities/resolve.d.ts +10 -0
  11. package/dist/activities/resolve.js +27 -0
  12. package/dist/activities/schedule-fire.js +5 -23
  13. package/dist/channel.d.ts +1 -1
  14. package/dist/channel.js +25 -6
  15. package/dist/cli/commands.d.ts +6 -1
  16. package/dist/cli/commands.js +273 -111
  17. package/dist/cli.js +9 -3
  18. package/dist/config.d.ts +1 -0
  19. package/dist/config.js +8 -1
  20. package/dist/connection.js +7 -0
  21. package/dist/ensemble/agent-types.d.ts +23 -0
  22. package/dist/ensemble/agent-types.js +125 -0
  23. package/dist/ensemble/loader.d.ts +3 -3
  24. package/dist/ensemble/loader.js +20 -14
  25. package/dist/ensemble/saver.d.ts +6 -6
  26. package/dist/ensemble/saver.js +14 -12
  27. package/dist/ensemble/schema.d.ts +7 -1
  28. package/dist/ensemble/schema.js +1 -1
  29. package/dist/server.js +91 -16
  30. package/dist/spawn.js +12 -12
  31. package/dist/tools/agent-types.d.ts +2 -0
  32. package/dist/tools/agent-types.js +18 -0
  33. package/dist/tools/cue.js +3 -2
  34. package/dist/tools/ensemble.js +5 -1
  35. package/dist/tools/{load-ensemble.d.ts → load-lineup.d.ts} +1 -1
  36. package/dist/tools/{load-ensemble.js → load-lineup.js} +63 -50
  37. package/dist/tools/recruit.js +38 -6
  38. package/dist/tools/report.js +2 -1
  39. package/dist/tools/resolve.d.ts +1 -8
  40. package/dist/tools/resolve.js +5 -23
  41. package/dist/tools/save-lineup.d.ts +4 -0
  42. package/dist/tools/save-lineup.js +50 -0
  43. package/dist/tools/schedule.js +7 -19
  44. package/dist/tools/set-name.js +5 -3
  45. package/dist/tools/set-part.js +2 -1
  46. package/dist/tools/who-am-i.d.ts +3 -0
  47. package/dist/tools/who-am-i.js +24 -0
  48. package/dist/types.d.ts +22 -4
  49. package/dist/utils/duration.d.ts +2 -0
  50. package/dist/utils/duration.js +17 -0
  51. package/dist/utils/safe-path.d.ts +10 -0
  52. package/dist/utils/safe-path.js +43 -0
  53. package/dist/utils/validation.d.ts +26 -0
  54. package/dist/utils/validation.js +44 -0
  55. package/dist/worker.d.ts +6 -2
  56. package/dist/worker.js +16 -4
  57. package/dist/workflows/session.js +16 -3
  58. package/dist/workflows/signals.d.ts +2 -0
  59. package/examples/agents/tempo-composer.md +44 -0
  60. package/examples/agents/tempo-conductor.md +52 -0
  61. package/examples/agents/tempo-critic.md +45 -0
  62. package/examples/agents/tempo-improv.md +47 -0
  63. package/examples/agents/tempo-liner.md +48 -0
  64. package/examples/agents/tempo-roadie.md +48 -0
  65. package/examples/agents/tempo-soloist.md +45 -0
  66. package/examples/agents/tempo-tuner.md +49 -0
  67. package/examples/ensembles/tempo-big-band.yaml +146 -0
  68. package/examples/ensembles/tempo-dev-team.yaml +58 -0
  69. package/examples/ensembles/tempo-jam-session.yaml +41 -0
  70. package/examples/ensembles/tempo-review-squad.yaml +32 -0
  71. package/package.json +119 -104
  72. package/workflow-bundle.js +17 -4
  73. package/dist/tools/save-ensemble.d.ts +0 -4
  74. package/dist/tools/save-ensemble.js +0 -44
package/CLAUDE.md CHANGED
@@ -1,96 +1,125 @@
1
- # CLAUDE.md
2
-
3
- ## What is this?
4
-
5
- claude-tempo is an MCP server that enables multiple Claude Code sessions to coordinate via Temporal.
6
-
7
- ## Tech Stack
8
-
9
- - **Runtime**: Node.js 18+ with TypeScript
10
- - **MCP**: `@modelcontextprotocol/sdk` (stdio transport)
11
- - **Temporal**: `@temporalio/client`, `@temporalio/worker`, `@temporalio/workflow`, `@temporalio/activity`
12
- - **No other dependencies** — no database, no custom broker
13
-
14
- ## Project Structure
15
-
16
- ```
17
- src/
18
- ├── server.ts # MCP server entry point
19
- ├── copilot-bridge.ts # Copilot SDK bridge for Copilot CLI players
20
- ├── worker.ts # Temporal worker setup
21
- ├── workflows/
22
- │ ├── session.ts # claude-session workflow
23
- └── signals.ts # Signal/query type definitions
24
- ├── activities/
25
- ├── outbox.ts # Outbox delivery activities (cue, report, stop, recruit)
26
- │ └── schedule-fire.ts # Schedule fire activity
27
- ├── tools/
28
- ├── ensemble.ts # Discover active sessions
29
- ├── cue.ts # Send message to peer (via outbox)
30
- ├── set-name.ts # Set session name
31
- │ ├── set-part.ts # Update own summary
32
- │ ├── resolve.ts # Search-attribute session lookup
33
- │ ├── listen.ts # Manual message check
34
- │ ├── recruit.ts # Spawn new session (via outbox)
35
- ├── report.ts # Report to conductor (via outbox)
36
- ├── stop.ts # Stop a session (via outbox)
37
- └── helpers.ts # Zod/MCP tool registration wrapper
38
- ├── types.ts # Shared type definitions
39
- ├── channel.ts # Claude channel notification helper
40
- ├── git-info.ts # Git repository detection helper
41
- └── config.ts # Env var handling
42
- ```
43
-
44
- ## Development
45
-
46
- ```bash
47
- # Install dependencies
48
- npm install
49
-
50
- # Start Temporal dev server (separate terminal)
51
- temporal server start-dev
52
-
53
- # Run in development
54
- npx ts-node src/server.ts
55
-
56
- # Build (compiles TS and pre-bundles workflow code)
57
- npm run build
58
-
59
- # Test
60
- npm test
61
- ```
62
-
63
- > **Important**: Always run `npm run build` after changing workflow code (`src/workflows/`).
64
- > The build pre-bundles workflows into `workflow-bundle.js` so all workers use identical code.
65
-
66
- > **Dual workers**: Each session runs two Temporal workers — a shared `claude-tempo` queue
67
- > (workflows + delivery activities) and a per-host `claude-tempo-{hostname}` queue (spawn activities only).
68
- > Both are created via `createWorkers()` in `src/worker.ts`.
69
-
70
- ## Key Concepts
71
-
72
- - **Player**: A Claude Code session registered as a Temporal workflow
73
- - **Conductor**: A special player that acts as orchestration hub, connected to external interfaces (one per ensemble)
74
- - **Ensemble**: The set of all active players, namespaced by `CLAUDE_TEMPO_ENSEMBLE`
75
- - **Cue**: A message sent to a player by name via Temporal signal
76
- - **Part**: A player's description of what it's working on
77
- - **Recruit**: Spawning a new Claude Code session as a player. The workflow is pre-created with the initial message before the process spawns, ensuring reliable delivery.
78
- - **set_name**: Players start with a random hex ID; `set_name` updates the `ClaudeTempoPlayerId` search attribute to a human-readable name
79
- - **Session status**: Each session has a status (`pending` → `active` → `stale`) tracked via `ClaudeTempoStatus` search attribute. Pre-created workflows start as `pending`, transition to `active` when the process connects, and become `stale` if messages go undelivered for 3+ minutes.
80
- - **Outbox**: Outbound requests (cue, report, stop, recruit) go through the session's own workflow outbox instead of directly signaling other workflows. The workflow's dispatch loop processes entries via activities, decoupling tools from cross-workflow signaling.
81
- - **Per-host task queues**: Each host runs a `claude-tempo-{hostname}` activity worker for local-only operations (e.g., `spawnProcess`). This enables cross-machine recruiting — the `recruit` tool accepts an optional `host` parameter to route the spawn to a remote machine's task queue.
82
-
83
- ## Dashboard
84
-
85
- The ensemble dashboard (Maestro) lives in a separate repository: [vinceblank/maestro](https://github.com/vinceblank/maestro)
86
-
87
- It provides a web UI for managing ensembles, communicating with conductors, and monitoring player activity.
88
-
89
- ## Commit Convention
90
-
91
- Use conventional commits: `type(scope): message`
92
-
93
- Examples:
94
- - `feat(tools): add ensemble discovery tool`
95
- - `fix(workflow): handle signal delivery edge case`
96
- - `docs: update getting started guide`
1
+ # CLAUDE.md
2
+
3
+ ## What is this?
4
+
5
+ claude-tempo is an MCP server that enables multiple Claude Code sessions to coordinate via Temporal.
6
+
7
+ ## Tech Stack
8
+
9
+ - **Runtime**: Node.js 18+ with TypeScript
10
+ - **MCP**: `@modelcontextprotocol/sdk` (stdio transport)
11
+ - **Temporal**: `@temporalio/client`, `@temporalio/worker`, `@temporalio/workflow`, `@temporalio/activity`
12
+ - **No other dependencies** — no database, no custom broker
13
+
14
+ ## Project Structure
15
+
16
+ ```
17
+ src/
18
+ ├── server.ts # MCP server entry point
19
+ ├── cli.ts # CLI entry point (claude-tempo command)
20
+ ├── cli/
21
+ ├── commands.ts # CLI command implementations (up, start, conduct, status, stop, …)
22
+ │ ├── config-command.ts # config subcommand (interactive + set/show)
23
+ ├── mcp.ts # MCP server registration helpers (init, global vs project)
24
+ ├── output.ts # Shared CLI output formatting helpers
25
+ └── preflight.ts # Environment preflight checks
26
+ ├── copilot-bridge.ts # Copilot SDK bridge for Copilot CLI players
27
+ ├── worker.ts # Temporal worker setup
28
+ ├── connection.ts # Temporal connection factory (shared by server + CLI)
29
+ ├── spawn.ts # Cross-platform process spawning helpers
30
+ ├── workflows/
31
+ │ ├── index.ts # Workflow exports (re-exports for worker bundle)
32
+ │ ├── session.ts # claude-session workflow
33
+ │ ├── scheduler.ts # durable scheduler workflow (one per ensemble)
34
+ │ ├── scheduler-signals.ts # Scheduler signal/query type definitions
35
+ └── signals.ts # Session signal/query type definitions
36
+ ├── activities/
37
+ ├── outbox.ts # Outbox delivery activities (cue, report, stop, recruit)
38
+ │ └── schedule-fire.ts # Schedule fire activity
39
+ ├── ensemble/
40
+ ├── schema.ts # Lineup type definitions
41
+ │ ├── loader.ts # Load and validate YAML lineups
42
+ │ ├── saver.ts # Save live ensemble state to YAML
43
+ │ └── agent-types.ts # Agent type discovery, resolution, and lineup resolution
44
+ ├── tools/
45
+ │ ├── ensemble.ts # Discover active sessions
46
+ │ ├── cue.ts # Send message to peer (via outbox)
47
+ │ ├── set-name.ts # Set session name
48
+ │ ├── set-part.ts # Update own summary
49
+ │ ├── who-am-i.ts # Query own identity, role, and session details
50
+ │ ├── agent-types.ts # Discover available player types (agent definitions)
51
+ │ ├── resolve.ts # Search-attribute session lookup
52
+ │ ├── listen.ts # Manual message check
53
+ │ ├── recruit.ts # Spawn new session (via outbox), supports `type` param
54
+ │ ├── report.ts # Report to conductor (via outbox)
55
+ │ ├── stop.ts # Stop a session (via outbox)
56
+ │ ├── load-lineup.ts # Load an ensemble lineup, recruit players
57
+ │ ├── save-lineup.ts # Save current ensemble state as a lineup
58
+ │ ├── schedule.ts # Create one-shot or recurring schedules
59
+ │ ├── unschedule.ts # Cancel a named schedule
60
+ │ ├── schedules.ts # List active schedules
61
+ │ └── helpers.ts # Zod/MCP tool registration wrapper
62
+ ├── types.ts # Shared type definitions
63
+ ├── channel.ts # Claude channel notification helper
64
+ ├── git-info.ts # Git repository detection helper
65
+ └── config.ts # Env var handling
66
+ ```
67
+
68
+ ## Development
69
+
70
+ ```bash
71
+ # Install dependencies
72
+ npm install
73
+
74
+ # Start Temporal dev server (separate terminal)
75
+ temporal server start-dev
76
+
77
+ # Run in development
78
+ npx ts-node src/server.ts
79
+
80
+ # Build (compiles TS and pre-bundles workflow code)
81
+ npm run build
82
+
83
+ # Test
84
+ npm test
85
+ ```
86
+
87
+ > **Important**: Always run `npm run build` after changing workflow code (`src/workflows/`).
88
+ > The build pre-bundles workflows into `workflow-bundle.js` so all workers use identical code.
89
+
90
+ > **Dual workers**: Each session runs two Temporal workers — a shared `claude-tempo` queue
91
+ > (workflows + delivery activities) and a per-host `claude-tempo-{hostname}` queue (spawn activities only).
92
+ > Both are created via `createWorkers()` in `src/worker.ts`.
93
+
94
+ ## Key Concepts
95
+
96
+ - **Player**: A Claude Code session registered as a Temporal workflow
97
+ - **Conductor**: A special player that acts as orchestration hub, connected to external interfaces (one per ensemble)
98
+ - **Ensemble**: The set of all active players, namespaced by `CLAUDE_TEMPO_ENSEMBLE`
99
+ - **Cue**: A message sent to a player by name via Temporal signal
100
+ - **Part**: A player's description of what it's working on
101
+ - **Recruit**: Spawning a new Claude Code session as a player. The workflow is pre-created with the initial message before the process spawns, ensuring reliable delivery.
102
+ - **set_name**: Players start with a random hex ID; `set_name` updates the `ClaudeTempoPlayerId` search attribute to a human-readable name
103
+ - **Session status**: Each session has a status (`pending` → `active` → `stale`) tracked via `ClaudeTempoStatus` search attribute. Pre-created workflows start as `pending`, transition to `active` when the process connects, and become `stale` if messages go undelivered for 3+ minutes.
104
+ - **Outbox**: Outbound requests (cue, report, stop, recruit) go through the session's own workflow outbox instead of directly signaling other workflows. The workflow's dispatch loop processes entries via activities, decoupling tools from cross-workflow signaling.
105
+ - **Per-host task queues**: Each host runs a `claude-tempo-{hostname}` activity worker for local-only operations (e.g., `spawnProcess`). This enables cross-machine recruiting — the `recruit` tool accepts an optional `host` parameter to route the spawn to a remote machine's task queue.
106
+ - **Player types**: Reusable agent definitions in Claude Code's standard subagent format (`.md` files with YAML frontmatter). Ensemble lineups can reference types by name via a `type` field on players. Three-tier lookup: project `.claude/agents/` → user `~/.claude/agents/` → shipped `examples/agents/`. Players know their type via workflow metadata and the `who_am_i` tool.
107
+ - **Agent type discovery**: The `agent_types` MCP tool and `claude-tempo agent-types` CLI command let conductors discover available player types. Shipped examples (tempo-conductor, tempo-composer, tempo-soloist, tempo-tuner, tempo-critic, tempo-roadie, tempo-improv, tempo-liner) work out of the box. Ensemble lineups: tempo-big-band (full lifecycle), tempo-dev-team (feature work), tempo-review-squad (parallel review), tempo-jam-session (exploration).
108
+ - **Schedule**: A one-shot or recurring message delivery configured via the `schedule` tool. Backed by a durable `claudeSchedulerWorkflow` — survives restarts. Supports delay, cron-style intervals, and time-bounded delivery. Managed via `schedule`, `unschedule`, and `schedules` tools.
109
+ - **Lineup**: A YAML file defining an ensemble configuration — which players to recruit, their types, working directories, and optional startup messages. Load via `load_lineup` to bootstrap a full ensemble in one step; save via `save_lineup` to snapshot a running ensemble's state for later reuse.
110
+ - **Wire protocol**: All Temporal signal, query, update, and workflow names are documented in [`docs/WIRE-PROTOCOL.md`](docs/WIRE-PROTOCOL.md). These names are stable as of v0.10 — renaming or removing any is a breaking change requiring a major version bump.
111
+
112
+ ## Dashboard
113
+
114
+ The ensemble dashboard (Maestro) lives in a separate repository: [vinceblank/maestro](https://github.com/vinceblank/maestro)
115
+
116
+ It provides a web UI for managing ensembles, communicating with conductors, and monitoring player activity.
117
+
118
+ ## Commit Convention
119
+
120
+ Use conventional commits: `type(scope): message`
121
+
122
+ Examples:
123
+ - `feat(tools): add ensemble discovery tool`
124
+ - `fix(workflow): handle signal delivery edge case`
125
+ - `docs: update getting started guide`
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026-present vinceblank
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.