zwarm 3.0.1__tar.gz → 3.2.1__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 (46) hide show
  1. zwarm-3.2.1/PKG-INFO +393 -0
  2. zwarm-3.2.1/README.md +380 -0
  3. {zwarm-3.0.1 → zwarm-3.2.1}/pyproject.toml +2 -1
  4. zwarm-3.2.1/src/zwarm/cli/interactive.py +749 -0
  5. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/cli/main.py +207 -854
  6. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/cli/pilot.py +293 -151
  7. zwarm-3.2.1/src/zwarm/core/__init__.py +20 -0
  8. zwarm-3.2.1/src/zwarm/core/checkpoints.py +216 -0
  9. zwarm-3.2.1/src/zwarm/core/costs.py +199 -0
  10. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/tools/delegation.py +18 -161
  11. zwarm-3.0.1/PKG-INFO +0 -309
  12. zwarm-3.0.1/README.md +0 -297
  13. zwarm-3.0.1/src/zwarm/core/__init__.py +0 -0
  14. {zwarm-3.0.1 → zwarm-3.2.1}/.gitignore +0 -0
  15. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/__init__.py +0 -0
  16. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/adapters/__init__.py +0 -0
  17. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/adapters/base.py +0 -0
  18. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/adapters/claude_code.py +0 -0
  19. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/adapters/codex_mcp.py +0 -0
  20. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/adapters/registry.py +0 -0
  21. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/adapters/test_codex_mcp.py +0 -0
  22. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/adapters/test_registry.py +0 -0
  23. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/cli/__init__.py +0 -0
  24. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/core/compact.py +0 -0
  25. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/core/config.py +0 -0
  26. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/core/environment.py +0 -0
  27. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/core/models.py +0 -0
  28. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/core/state.py +0 -0
  29. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/core/test_compact.py +0 -0
  30. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/core/test_config.py +0 -0
  31. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/core/test_models.py +0 -0
  32. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/orchestrator.py +0 -0
  33. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/prompts/__init__.py +0 -0
  34. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/prompts/orchestrator.py +0 -0
  35. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/prompts/pilot.py +0 -0
  36. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/sessions/__init__.py +0 -0
  37. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/sessions/manager.py +0 -0
  38. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/test_orchestrator_watchers.py +0 -0
  39. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/tools/__init__.py +0 -0
  40. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/watchers/__init__.py +0 -0
  41. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/watchers/base.py +0 -0
  42. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/watchers/builtin.py +0 -0
  43. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/watchers/llm_watcher.py +0 -0
  44. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/watchers/manager.py +0 -0
  45. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/watchers/registry.py +0 -0
  46. {zwarm-3.0.1 → zwarm-3.2.1}/src/zwarm/watchers/test_watchers.py +0 -0
zwarm-3.2.1/PKG-INFO ADDED
@@ -0,0 +1,393 @@
1
+ Metadata-Version: 2.4
2
+ Name: zwarm
3
+ Version: 3.2.1
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"` | Start a new session |
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)` | 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
+ ### Watchers
239
+
240
+ Watchers monitor the orchestrator and intervene when needed:
241
+
242
+ | Watcher | Purpose |
243
+ |---------|---------|
244
+ | `progress` | Detects stuck/spinning behavior |
245
+ | `budget` | Enforces step/session limits |
246
+ | `delegation` | Tracks delegation patterns |
247
+ | `delegation_reminder` | Nudges to delegate when doing too much directly |
248
+
249
+ ---
250
+
251
+ ## Session Management
252
+
253
+ ### Quick Commands
254
+
255
+ ```bash
256
+ # List all sessions with costs
257
+ zwarm sessions
258
+
259
+ # Clean up old sessions
260
+ zwarm sessions --clean
261
+ zwarm sessions -c
262
+
263
+ # Kill all running sessions
264
+ zwarm sessions --kill-all
265
+ zwarm sessions -k
266
+
267
+ # Target specific session
268
+ zwarm sessions --rm abc123
269
+ zwarm sessions --kill abc123
270
+ ```
271
+
272
+ ### Session Lifecycle
273
+
274
+ ```
275
+ spawn → running → completed/failed/killed
276
+
277
+ converse → running → completed
278
+
279
+ converse → ...
280
+ ```
281
+
282
+ ### Storage
283
+
284
+ ```
285
+ .zwarm/sessions/<uuid>/
286
+ ├── meta.json # Status, task, model, tokens, cost
287
+ └── turns/
288
+ ├── turn_1.jsonl # Raw codex output for turn 1
289
+ ├── turn_2.jsonl # Output after continue
290
+ └── ...
291
+ ```
292
+
293
+ ---
294
+
295
+ ## Configuration
296
+
297
+ ### Initialize
298
+
299
+ ```bash
300
+ zwarm init
301
+ ```
302
+
303
+ This creates:
304
+ - `.zwarm/config.toml` - Runtime settings (Weave, watchers)
305
+ - `.zwarm/codex.toml` - Codex CLI settings (model, reasoning)
306
+ - `zwarm.yaml` - Project context (optional, with `--with-project`)
307
+
308
+ ### Config Files
309
+
310
+ **`.zwarm/config.toml`** - Controls zwarm itself:
311
+ ```toml
312
+ [weave]
313
+ project = "your-entity/zwarm"
314
+
315
+ [orchestrator]
316
+ max_steps = 50
317
+
318
+ [executor]
319
+ adapter = "codex_mcp"
320
+
321
+ [watchers]
322
+ enabled = ["progress", "budget", "delegation", "delegation_reminder"]
323
+ ```
324
+
325
+ **`.zwarm/codex.toml`** - Controls the Codex CLI:
326
+ ```toml
327
+ model = "gpt-5.1-codex-mini"
328
+ model_reasoning_effort = "high" # low | medium | high
329
+ ```
330
+
331
+ **`zwarm.yaml`** - Project-specific context:
332
+ ```yaml
333
+ description: "My awesome project"
334
+
335
+ context: |
336
+ Tech stack: FastAPI, PostgreSQL, React
337
+ Key directories: src/api/, src/components/
338
+
339
+ constraints:
340
+ - "All new endpoints need tests"
341
+ - "Use existing patterns from src/api/"
342
+ ```
343
+
344
+ ---
345
+
346
+ ## CLI Reference
347
+
348
+ ```bash
349
+ # Setup
350
+ zwarm init # Initialize .zwarm/ with interactive prompts
351
+ zwarm init --yes # Quick setup with defaults
352
+
353
+ # Interfaces
354
+ zwarm pilot # Conversational LLM guidance (recommended)
355
+ zwarm interactive # Direct session control REPL
356
+ zwarm orchestrate # Fully autonomous LLM
357
+
358
+ # Session management
359
+ zwarm sessions # List all sessions
360
+ zwarm sessions -c # Clean old sessions
361
+ zwarm sessions -k # Kill all running
362
+
363
+ # Utilities
364
+ zwarm exec # Run single executor (testing)
365
+ zwarm clean # Kill orphaned processes
366
+ zwarm reset # Reset .zwarm/ state
367
+ ```
368
+
369
+ ---
370
+
371
+ ## Project Structure
372
+
373
+ ```
374
+ zwarm/
375
+ ├── src/zwarm/
376
+ │ ├── sessions/ # Session substrate
377
+ │ │ └── manager.py # CodexSessionManager (ground truth)
378
+ │ ├── cli/
379
+ │ │ ├── main.py # CLI commands
380
+ │ │ ├── pilot.py # Pilot REPL
381
+ │ │ └── interactive.py # Interactive REPL
382
+ │ ├── tools/
383
+ │ │ └── delegation.py # Orchestrator tools
384
+ │ ├── core/
385
+ │ │ ├── config.py # Configuration
386
+ │ │ ├── checkpoints.py # Time-travel primitives
387
+ │ │ ├── costs.py # Token cost estimation
388
+ │ │ └── state.py # State persistence
389
+ │ ├── watchers/ # Trajectory alignment
390
+ │ ├── prompts/ # System prompts
391
+ │ └── orchestrator.py # Orchestrator agent
392
+ └── STATE.md # Current project state
393
+ ```