zwarm 3.2.0__tar.gz → 3.3.0__tar.gz

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 (45) hide show
  1. zwarm-3.3.0/PKG-INFO +396 -0
  2. zwarm-3.3.0/README.md +383 -0
  3. {zwarm-3.2.0 → zwarm-3.3.0}/pyproject.toml +1 -1
  4. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/cli/interactive.py +2 -2
  5. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/cli/main.py +75 -77
  6. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/cli/pilot.py +3 -1
  7. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/core/config.py +24 -9
  8. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/core/test_config.py +2 -3
  9. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/orchestrator.py +8 -44
  10. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/sessions/manager.py +210 -90
  11. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/tools/delegation.py +6 -1
  12. zwarm-3.2.0/PKG-INFO +0 -310
  13. zwarm-3.2.0/README.md +0 -297
  14. zwarm-3.2.0/src/zwarm/adapters/__init__.py +0 -21
  15. zwarm-3.2.0/src/zwarm/adapters/base.py +0 -109
  16. zwarm-3.2.0/src/zwarm/adapters/claude_code.py +0 -357
  17. zwarm-3.2.0/src/zwarm/adapters/codex_mcp.py +0 -1262
  18. zwarm-3.2.0/src/zwarm/adapters/registry.py +0 -69
  19. zwarm-3.2.0/src/zwarm/adapters/test_codex_mcp.py +0 -274
  20. zwarm-3.2.0/src/zwarm/adapters/test_registry.py +0 -68
  21. {zwarm-3.2.0 → zwarm-3.3.0}/.gitignore +0 -0
  22. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/__init__.py +0 -0
  23. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/cli/__init__.py +0 -0
  24. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/core/__init__.py +0 -0
  25. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/core/checkpoints.py +0 -0
  26. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/core/compact.py +0 -0
  27. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/core/costs.py +0 -0
  28. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/core/environment.py +0 -0
  29. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/core/models.py +0 -0
  30. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/core/state.py +0 -0
  31. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/core/test_compact.py +0 -0
  32. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/core/test_models.py +0 -0
  33. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/prompts/__init__.py +0 -0
  34. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/prompts/orchestrator.py +0 -0
  35. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/prompts/pilot.py +0 -0
  36. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/sessions/__init__.py +0 -0
  37. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/test_orchestrator_watchers.py +0 -0
  38. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/tools/__init__.py +0 -0
  39. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/watchers/__init__.py +0 -0
  40. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/watchers/base.py +0 -0
  41. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/watchers/builtin.py +0 -0
  42. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/watchers/llm_watcher.py +0 -0
  43. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/watchers/manager.py +0 -0
  44. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/watchers/registry.py +0 -0
  45. {zwarm-3.2.0 → zwarm-3.3.0}/src/zwarm/watchers/test_watchers.py +0 -0
zwarm-3.3.0/PKG-INFO ADDED
@@ -0,0 +1,396 @@
1
+ Metadata-Version: 2.4
2
+ Name: zwarm
3
+ Version: 3.3.0
4
+ Summary: Multi-Agent CLI Orchestration Research Platform
5
+ Requires-Python: <3.14,>=3.13
6
+ Requires-Dist: prompt-toolkit>=3.0.52
7
+ Requires-Dist: python-dotenv>=1.0.0
8
+ Requires-Dist: pyyaml>=6.0
9
+ Requires-Dist: rich>=13.0.0
10
+ Requires-Dist: typer>=0.9.0
11
+ Requires-Dist: wbal>=0.5.8
12
+ Description-Content-Type: text/markdown
13
+
14
+ # zwarm
15
+
16
+ Multi-agent CLI for orchestrating coding agents. Spawn, manage, and converse with multiple Codex sessions in parallel.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ # From the workspace
22
+ cd /path/to/labs
23
+ uv sync
24
+
25
+ # Or install directly
26
+ uv pip install -e ./zwarm
27
+ ```
28
+
29
+ **Requirements:**
30
+ - Python 3.13+
31
+ - `codex` CLI installed and authenticated
32
+
33
+ **Environment:**
34
+ ```bash
35
+ export OPENAI_API_KEY="sk-..." # Required for Codex
36
+ export WEAVE_PROJECT="entity/zwarm" # Optional: Weave tracing
37
+ ```
38
+
39
+ ## Three Interfaces
40
+
41
+ zwarm has three ways to work with coding agents:
42
+
43
+ | Interface | Who drives | Use case |
44
+ |-----------|------------|----------|
45
+ | `zwarm interactive` | **You** | Direct session control, experimentation |
46
+ | `zwarm pilot` | **You + LLM** | Conversational guidance with checkpoints |
47
+ | `zwarm orchestrate` | **LLM** | Fully autonomous task execution |
48
+
49
+ All three use the **same session manager** - they're different interfaces to the same underlying system.
50
+
51
+ ```
52
+ .zwarm/sessions/ (GROUND TRUTH)
53
+
54
+ ┌───────────────┼───────────────┐
55
+ │ │ │
56
+ ▼ ▼ ▼
57
+ Orchestrate Pilot Interactive
58
+ (LLM) (LLM+REPL) (REPL)
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Quick Start
64
+
65
+ ```bash
66
+ # Initialize zwarm in your project
67
+ zwarm init
68
+
69
+ # Start the pilot (recommended for most users)
70
+ zwarm pilot --task "Build a REST API with authentication"
71
+
72
+ # Or go fully autonomous
73
+ zwarm orchestrate --task "Build a REST API with authentication"
74
+
75
+ # Or manual control
76
+ zwarm interactive
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Pilot Mode
82
+
83
+ **You chat with an LLM that delegates to coding agents.** Best of both worlds - LLM intelligence with human oversight.
84
+
85
+ ```bash
86
+ zwarm pilot
87
+ zwarm pilot --task "Add user authentication"
88
+ ```
89
+
90
+ ### Features
91
+
92
+ - **Conversational**: Chat naturally, the LLM handles delegation
93
+ - **Checkpoints**: Every turn is saved, time-travel with `:goto`
94
+ - **Multiline input**: Use `"""` for pasting large prompts
95
+ - **Status bar**: See token usage, cost estimates, context window
96
+
97
+ ### Commands
98
+
99
+ | Command | Description |
100
+ |---------|-------------|
101
+ | `:help` | Show all commands |
102
+ | `:status` | Token usage, cost, context window |
103
+ | `:history` | Show turn checkpoints |
104
+ | `:goto T3` | Jump back to turn 3 |
105
+ | `:sessions` | List executor sessions |
106
+ | `:quit` | Exit |
107
+
108
+ ### Example
109
+
110
+ ```
111
+ $ zwarm pilot
112
+
113
+ > Add a login endpoint to the API
114
+
115
+ Chooooching...
116
+
117
+ I'll delegate this to a coding agent.
118
+
119
+ [delegate] task: "Add login endpoint with JWT..."
120
+ → Session abc123 started
121
+
122
+ The agent is working on it. I'll check back shortly.
123
+
124
+ [sleep] 10s
125
+ [check_session] abc123
126
+ → completed (45s, 12k tokens)
127
+
128
+ Done! The agent added a /login endpoint with JWT support...
129
+
130
+ > Now add rate limiting
131
+
132
+ I'll have the same agent continue with rate limiting.
133
+
134
+ [converse] abc123: "Add rate limiting to the login endpoint..."
135
+ ```
136
+
137
+ ### Multiline Input
138
+
139
+ Start with `"""` and end with `"""`:
140
+
141
+ ```
142
+ > """
143
+ Here's a complex task:
144
+ 1. Add authentication
145
+ 2. Add rate limiting
146
+ 3. Add tests
147
+ """
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Interactive Mode
153
+
154
+ **You are the orchestrator.** Direct control over sessions with autocomplete.
155
+
156
+ ```bash
157
+ zwarm interactive
158
+ ```
159
+
160
+ ### Commands
161
+
162
+ | Command | Description |
163
+ |---------|-------------|
164
+ | `spawn "task" [--search]` | Start a new session (--search enables web) |
165
+ | `ls` | Dashboard of all sessions (with costs) |
166
+ | `? ID` / `peek ID` | Quick status check |
167
+ | `show ID` | Full session details |
168
+ | `traj ID` | Show trajectory (steps taken) |
169
+ | `watch ID` | Live follow session output |
170
+ | `c ID "msg"` | Continue conversation |
171
+ | `kill ID \| all` | Stop session(s) |
172
+ | `rm ID \| all` | Delete session(s) |
173
+ | `help` | Show all commands |
174
+ | `quit` | Exit |
175
+
176
+ ### Example
177
+
178
+ ```
179
+ $ zwarm interactive
180
+
181
+ > spawn "Add tests for the auth module"
182
+ ✓ Started abc123 (running)
183
+ Use 'watch abc123' to follow
184
+
185
+ > spawn "Fix type errors in utils.py"
186
+ ✓ Started def456 (running)
187
+
188
+ > ls
189
+ ⟳ 2 running
190
+
191
+ ID │ │ Task │ Tokens │ Cost
192
+ abc123 │ ⟳ │ Add tests for the auth... │ 5,234 │ $0.052
193
+ def456 │ ⟳ │ Fix type errors in utils... │ 2,100 │ $0.021
194
+
195
+ > watch abc123
196
+ Watching abc123... (Ctrl+C to stop)
197
+ [step 3] shell: pytest tests/
198
+ [step 4] write: tests/test_auth.py
199
+ ...
200
+
201
+ > c abc123 "Also add edge case tests"
202
+ ✓ Injected message, session running
203
+
204
+ > kill all
205
+ ✓ Killed abc123
206
+ ✓ Killed def456
207
+ Killed 2 session(s)
208
+ ```
209
+
210
+ ---
211
+
212
+ ## Orchestrate Mode
213
+
214
+ **An LLM runs autonomously.** Give it a task, it delegates to coding agents and manages them.
215
+
216
+ ```bash
217
+ zwarm orchestrate --task "Build a REST API with authentication"
218
+ zwarm orchestrate --task-file task.md
219
+ echo "Fix the bug" | zwarm orchestrate
220
+ ```
221
+
222
+ ### How It Works
223
+
224
+ The orchestrator LLM has access to:
225
+
226
+ | Tool | Description |
227
+ |------|-------------|
228
+ | `delegate(task, web_search=False)` | Start a new coding session |
229
+ | `converse(id, msg)` | Continue a session |
230
+ | `check_session(id)` | Get full session details |
231
+ | `peek_session(id)` | Quick status check |
232
+ | `list_sessions()` | List all sessions |
233
+ | `end_session(id)` | Kill/delete a session |
234
+ | `sleep(seconds)` | Wait before checking again |
235
+
236
+ **Async-first**: All sessions run in the background. The orchestrator uses `sleep()` to wait, then checks on progress.
237
+
238
+ **Web Search**: Pass `web_search=True` to `delegate()` for tasks needing current info (API docs, latest releases, etc.).
239
+
240
+ ### Watchers
241
+
242
+ Watchers monitor the orchestrator and intervene when needed:
243
+
244
+ | Watcher | Purpose |
245
+ |---------|---------|
246
+ | `progress` | Detects stuck/spinning behavior |
247
+ | `budget` | Enforces step/session limits |
248
+ | `delegation` | Tracks delegation patterns |
249
+ | `delegation_reminder` | Nudges to delegate when doing too much directly |
250
+
251
+ ---
252
+
253
+ ## Session Management
254
+
255
+ ### Quick Commands
256
+
257
+ ```bash
258
+ # List all sessions with costs
259
+ zwarm sessions
260
+
261
+ # Clean up old sessions
262
+ zwarm sessions --clean
263
+ zwarm sessions -c
264
+
265
+ # Kill all running sessions
266
+ zwarm sessions --kill-all
267
+ zwarm sessions -k
268
+
269
+ # Target specific session
270
+ zwarm sessions --rm abc123
271
+ zwarm sessions --kill abc123
272
+ ```
273
+
274
+ ### Session Lifecycle
275
+
276
+ ```
277
+ spawn → running → completed/failed/killed
278
+
279
+ converse → running → completed
280
+
281
+ converse → ...
282
+ ```
283
+
284
+ ### Storage
285
+
286
+ ```
287
+ .zwarm/sessions/<uuid>/
288
+ ├── meta.json # Status, task, model, tokens, cost
289
+ └── turns/
290
+ ├── turn_1.jsonl # Raw codex output for turn 1
291
+ ├── turn_2.jsonl # Output after continue
292
+ └── ...
293
+ ```
294
+
295
+ ---
296
+
297
+ ## Configuration
298
+
299
+ ### Initialize
300
+
301
+ ```bash
302
+ zwarm init
303
+ ```
304
+
305
+ This creates:
306
+ - `.zwarm/config.toml` - Runtime settings (Weave, watchers)
307
+ - `.zwarm/codex.toml` - Codex CLI settings (model, reasoning)
308
+ - `zwarm.yaml` - Project context (optional, with `--with-project`)
309
+
310
+ ### Config Files
311
+
312
+ **`.zwarm/config.toml`** - Controls zwarm itself:
313
+ ```toml
314
+ [weave]
315
+ project = "your-entity/zwarm"
316
+
317
+ [orchestrator]
318
+ max_steps = 50
319
+
320
+ [executor]
321
+ adapter = "codex_mcp"
322
+ web_search = false # Enable web search for all delegated sessions
323
+
324
+ [watchers]
325
+ enabled = ["progress", "budget", "delegation", "delegation_reminder"]
326
+ ```
327
+
328
+ **`.zwarm/codex.toml`** - Controls the Codex CLI:
329
+ ```toml
330
+ model = "gpt-5.1-codex-mini"
331
+ model_reasoning_effort = "high" # low | medium | high
332
+ ```
333
+
334
+ **`zwarm.yaml`** - Project-specific context:
335
+ ```yaml
336
+ description: "My awesome project"
337
+
338
+ context: |
339
+ Tech stack: FastAPI, PostgreSQL, React
340
+ Key directories: src/api/, src/components/
341
+
342
+ constraints:
343
+ - "All new endpoints need tests"
344
+ - "Use existing patterns from src/api/"
345
+ ```
346
+
347
+ ---
348
+
349
+ ## CLI Reference
350
+
351
+ ```bash
352
+ # Setup
353
+ zwarm init # Initialize .zwarm/ with interactive prompts
354
+ zwarm init --yes # Quick setup with defaults
355
+
356
+ # Interfaces
357
+ zwarm pilot # Conversational LLM guidance (recommended)
358
+ zwarm interactive # Direct session control REPL
359
+ zwarm orchestrate # Fully autonomous LLM
360
+
361
+ # Session management
362
+ zwarm sessions # List all sessions
363
+ zwarm sessions -c # Clean old sessions
364
+ zwarm sessions -k # Kill all running
365
+
366
+ # Utilities
367
+ zwarm exec # Run single executor (testing)
368
+ zwarm clean # Kill orphaned processes
369
+ zwarm reset # Reset .zwarm/ state
370
+ ```
371
+
372
+ ---
373
+
374
+ ## Project Structure
375
+
376
+ ```
377
+ zwarm/
378
+ ├── src/zwarm/
379
+ │ ├── sessions/ # Session substrate
380
+ │ │ └── manager.py # CodexSessionManager (ground truth)
381
+ │ ├── cli/
382
+ │ │ ├── main.py # CLI commands
383
+ │ │ ├── pilot.py # Pilot REPL
384
+ │ │ └── interactive.py # Interactive REPL
385
+ │ ├── tools/
386
+ │ │ └── delegation.py # Orchestrator tools
387
+ │ ├── core/
388
+ │ │ ├── config.py # Configuration
389
+ │ │ ├── checkpoints.py # Time-travel primitives
390
+ │ │ ├── costs.py # Token cost estimation
391
+ │ │ └── state.py # State persistence
392
+ │ ├── watchers/ # Trajectory alignment
393
+ │ ├── prompts/ # System prompts
394
+ │ └── orchestrator.py # Orchestrator agent
395
+ └── STATE.md # Current project state
396
+ ```