claude-tempo 0.10.0 → 0.11.1
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.
- package/CLAUDE.md +144 -110
- package/LICENSE +21 -0
- package/README.md +698 -665
- package/assets/icon-dark.svg +9 -9
- package/assets/icon.svg +9 -9
- package/assets/logo-dark.svg +11 -11
- package/assets/logo-light.svg +11 -11
- package/dist/activities/outbox.d.ts +20 -3
- package/dist/activities/outbox.js +88 -24
- package/dist/activities/resolve.d.ts +10 -0
- package/dist/activities/resolve.js +27 -0
- package/dist/activities/schedule-fire.js +5 -23
- package/dist/channel.d.ts +1 -1
- package/dist/channel.js +25 -6
- package/dist/cli/commands.d.ts +13 -0
- package/dist/cli/commands.js +251 -74
- package/dist/cli.js +39 -0
- package/dist/config.js +7 -1
- package/dist/connection.js +7 -0
- package/dist/server.js +70 -12
- package/dist/spawn.js +12 -12
- package/dist/tools/broadcast.d.ts +4 -0
- package/dist/tools/broadcast.js +78 -0
- package/dist/tools/cue.js +3 -2
- package/dist/tools/encore.d.ts +4 -0
- package/dist/tools/encore.js +75 -0
- package/dist/tools/load-lineup.js +14 -22
- package/dist/tools/recall.d.ts +3 -0
- package/dist/tools/recall.js +89 -0
- package/dist/tools/recruit.js +7 -5
- package/dist/tools/report.js +2 -1
- package/dist/tools/resolve.d.ts +1 -8
- package/dist/tools/resolve.js +5 -23
- package/dist/tools/save-lineup.js +10 -3
- package/dist/tools/schedule.js +7 -19
- package/dist/tools/set-name.js +5 -3
- package/dist/tools/set-part.js +2 -1
- package/dist/types.d.ts +8 -5
- package/dist/utils/duration.d.ts +2 -0
- package/dist/utils/duration.js +17 -0
- package/dist/utils/safe-path.d.ts +10 -0
- package/dist/utils/safe-path.js +43 -0
- package/dist/utils/validation.d.ts +35 -0
- package/dist/utils/validation.js +61 -0
- package/dist/worker.d.ts +6 -2
- package/dist/worker.js +17 -4
- package/dist/workflows/session.js +63 -4
- package/dist/workflows/signals.d.ts +6 -1
- package/dist/workflows/signals.js +4 -1
- package/examples/agents/tempo-composer.md +44 -44
- package/examples/agents/tempo-conductor.md +52 -52
- package/examples/agents/tempo-critic.md +45 -45
- package/examples/agents/tempo-improv.md +47 -47
- package/examples/agents/tempo-liner.md +48 -48
- package/examples/agents/tempo-roadie.md +48 -48
- package/examples/agents/tempo-soloist.md +45 -45
- package/examples/agents/tempo-tuner.md +49 -49
- package/examples/ensembles/tempo-big-band.yaml +146 -146
- package/examples/ensembles/tempo-dev-team.yaml +58 -58
- package/examples/ensembles/tempo-jam-session.yaml +41 -41
- package/examples/ensembles/tempo-review-squad.yaml +32 -32
- package/package.json +119 -105
- package/workflow-bundle.js +68 -6
- package/dist/tools/load-ensemble.d.ts +0 -5
- package/dist/tools/load-ensemble.js +0 -300
- package/dist/tools/save-ensemble.d.ts +0 -4
- package/dist/tools/save-ensemble.js +0 -44
package/CLAUDE.md
CHANGED
|
@@ -1,110 +1,144 @@
|
|
|
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
|
-
├──
|
|
20
|
-
├──
|
|
21
|
-
├──
|
|
22
|
-
│ ├──
|
|
23
|
-
│
|
|
24
|
-
├──
|
|
25
|
-
│
|
|
26
|
-
|
|
27
|
-
├──
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
│
|
|
32
|
-
├──
|
|
33
|
-
│ ├──
|
|
34
|
-
│ ├──
|
|
35
|
-
│
|
|
36
|
-
|
|
37
|
-
│ ├──
|
|
38
|
-
│
|
|
39
|
-
|
|
40
|
-
│ ├──
|
|
41
|
-
│ ├──
|
|
42
|
-
│ ├──
|
|
43
|
-
│
|
|
44
|
-
|
|
45
|
-
│ ├──
|
|
46
|
-
│ ├──
|
|
47
|
-
│ ├──
|
|
48
|
-
│ ├──
|
|
49
|
-
│
|
|
50
|
-
├── types.ts
|
|
51
|
-
├──
|
|
52
|
-
├──
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
#
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
#
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
#
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
- `
|
|
109
|
-
-
|
|
110
|
-
- `
|
|
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, encore)
|
|
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
|
+
│ ├── broadcast.ts # Send message to all active players (via outbox fan-out)
|
|
57
|
+
│ ├── encore.ts # Revive a stale session (via outbox)
|
|
58
|
+
│ ├── recall.ts # Read own message history (received + sent)
|
|
59
|
+
│ ├── load-lineup.ts # Load an ensemble lineup, recruit players
|
|
60
|
+
│ ├── save-lineup.ts # Save current ensemble state as a lineup
|
|
61
|
+
│ ├── schedule.ts # Create one-shot or recurring schedules
|
|
62
|
+
│ ├── unschedule.ts # Cancel a named schedule
|
|
63
|
+
│ ├── schedules.ts # List active schedules
|
|
64
|
+
│ └── helpers.ts # Zod/MCP tool registration wrapper
|
|
65
|
+
├── utils/
|
|
66
|
+
│ └── validation.ts # Shared validation constants (name/message/path limits, encore defaults) and helpers
|
|
67
|
+
├── types.ts # Shared type definitions
|
|
68
|
+
├── channel.ts # Claude channel notification helper
|
|
69
|
+
├── git-info.ts # Git repository detection helper
|
|
70
|
+
└── config.ts # Env var handling
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Development
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Install dependencies
|
|
77
|
+
npm install
|
|
78
|
+
|
|
79
|
+
# Start Temporal dev server (separate terminal)
|
|
80
|
+
temporal server start-dev
|
|
81
|
+
|
|
82
|
+
# Run in development
|
|
83
|
+
npx ts-node src/server.ts
|
|
84
|
+
|
|
85
|
+
# Build (compiles TS and pre-bundles workflow code)
|
|
86
|
+
npm run build
|
|
87
|
+
|
|
88
|
+
# Test
|
|
89
|
+
npm test
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
> **Important**: Always run `npm run build` after changing workflow code (`src/workflows/`).
|
|
93
|
+
> The build pre-bundles workflows into `workflow-bundle.js` so all workers use identical code.
|
|
94
|
+
|
|
95
|
+
> **Dual workers**: Each session runs two Temporal workers — a shared `claude-tempo` queue
|
|
96
|
+
> (workflows + delivery activities) and a per-host `claude-tempo-{hostname}` queue (spawn activities only).
|
|
97
|
+
> Both are created via `createWorkers()` in `src/worker.ts`.
|
|
98
|
+
|
|
99
|
+
## Key Concepts
|
|
100
|
+
|
|
101
|
+
- **Player**: A Claude Code session registered as a Temporal workflow
|
|
102
|
+
- **Conductor**: A special player that acts as orchestration hub, connected to external interfaces (one per ensemble)
|
|
103
|
+
- **Ensemble**: The set of all active players, namespaced by `CLAUDE_TEMPO_ENSEMBLE`
|
|
104
|
+
- **Cue**: A message sent to a player by name via Temporal signal
|
|
105
|
+
- **Part**: A player's description of what it's working on
|
|
106
|
+
- **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.
|
|
107
|
+
- **set_name**: Players start with a random hex ID; `set_name` updates the `ClaudeTempoPlayerId` search attribute to a human-readable name
|
|
108
|
+
- **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.
|
|
109
|
+
- **Outbox**: Outbound requests (cue, report, stop, recruit, encore) 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.
|
|
110
|
+
- **Encore**: Revives a `stale` player session by restarting the Claude process and reconnecting to the existing Temporal workflow, with recent message context restored. Cannot encore `active`, `pending`, or `terminated` sessions — use `cue`, wait, or `recruit` respectively.
|
|
111
|
+
- **Broadcast**: Fan-out variant of `cue` — sends a message to all active players in the ensemble in a single call. Optionally filtered by player type. Skips the sender, pending sessions, and (by default) stale sessions.
|
|
112
|
+
- **Recall**: Queries a session's own message history from the Temporal workflow. Shows received messages by default; pass `includeSent: true` to also see sent messages. Supports `limit`, `since`, and `from` filters.
|
|
113
|
+
- **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.
|
|
114
|
+
- **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.
|
|
115
|
+
- **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).
|
|
116
|
+
- **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.
|
|
117
|
+
- **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.
|
|
118
|
+
- **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.
|
|
119
|
+
|
|
120
|
+
## Dashboard
|
|
121
|
+
|
|
122
|
+
The ensemble dashboard (Maestro) lives in a separate repository: [vinceblank/maestro](https://github.com/vinceblank/maestro)
|
|
123
|
+
|
|
124
|
+
It provides a web UI for managing ensembles, communicating with conductors, and monitoring player activity.
|
|
125
|
+
|
|
126
|
+
## Commit Convention
|
|
127
|
+
|
|
128
|
+
Use conventional commits: `type(scope): message`
|
|
129
|
+
|
|
130
|
+
Examples:
|
|
131
|
+
- `feat(tools): add ensemble discovery tool`
|
|
132
|
+
- `fix(workflow): handle signal delivery edge case`
|
|
133
|
+
- `docs: update getting started guide`
|
|
134
|
+
|
|
135
|
+
## Release Process
|
|
136
|
+
|
|
137
|
+
**Correct order — never deviate:**
|
|
138
|
+
|
|
139
|
+
1. Merge the feature PR into `main` (squash merge)
|
|
140
|
+
2. Bump `version` in `package.json` and add a `## [x.y.z]` entry in `CHANGELOG.md` on `main`
|
|
141
|
+
3. Commit: `chore: bump version to vX.Y.Z`
|
|
142
|
+
4. Tag the bump commit: `git tag vX.Y.Z && git push origin vX.Y.Z`
|
|
143
|
+
|
|
144
|
+
The release workflow triggers on `v*` tag pushes and publishes to npm. **Never tag before the version bump commit exists on main, and never tag a commit that doesn't match the version in `package.json`.** Tagging prematurely (e.g., before a feature PR merges) publishes the old version to npm and forces a patch bump to recover.
|
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.
|