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