zwarm 3.10.2__py3-none-any.whl → 3.10.5__py3-none-any.whl
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.
- zwarm/cli/interactive.py +2 -2
- zwarm/cli/main.py +3 -5
- zwarm/cli/pilot.py +5 -13
- zwarm/compression/__init__.py +37 -0
- zwarm/compression/rollout_compression.py +292 -0
- zwarm/compression/tc_compression.py +165 -0
- zwarm/core/config.py +33 -6
- zwarm/core/registry.py +2 -20
- zwarm/orchestrator.py +43 -0
- zwarm/prompts/orchestrator.py +98 -137
- zwarm/prompts/pilot.py +15 -11
- zwarm/sessions/manager.py +2 -2
- zwarm/tools/delegation.py +86 -94
- zwarm/watchers/llm_watcher.py +1 -1
- {zwarm-3.10.2.dist-info → zwarm-3.10.5.dist-info}/METADATA +22 -15
- {zwarm-3.10.2.dist-info → zwarm-3.10.5.dist-info}/RECORD +18 -15
- {zwarm-3.10.2.dist-info → zwarm-3.10.5.dist-info}/WHEEL +0 -0
- {zwarm-3.10.2.dist-info → zwarm-3.10.5.dist-info}/entry_points.txt +0 -0
zwarm/core/registry.py
CHANGED
|
@@ -23,7 +23,7 @@ class ModelInfo:
|
|
|
23
23
|
"""Complete information about an LLM model."""
|
|
24
24
|
|
|
25
25
|
# Identity
|
|
26
|
-
canonical: str # Full model name (e.g., "gpt-5.
|
|
26
|
+
canonical: str # Full model name (e.g., "gpt-5.2-codex")
|
|
27
27
|
adapter: str # "codex" or "claude"
|
|
28
28
|
aliases: list[str] = field(default_factory=list) # Short names
|
|
29
29
|
|
|
@@ -80,24 +80,6 @@ MODELS: list[ModelInfo] = [
|
|
|
80
80
|
cached_input_per_million=0.20,
|
|
81
81
|
description="GPT-5.2 with extended reasoning (xhigh)",
|
|
82
82
|
),
|
|
83
|
-
ModelInfo(
|
|
84
|
-
canonical="gpt-5.1-codex-mini",
|
|
85
|
-
adapter="codex",
|
|
86
|
-
aliases=["codex-mini", "mini", "5.1-mini"],
|
|
87
|
-
input_per_million=0.25,
|
|
88
|
-
output_per_million=2.00,
|
|
89
|
-
cached_input_per_million=0.025,
|
|
90
|
-
description="Fast, cost-effective coding model",
|
|
91
|
-
),
|
|
92
|
-
ModelInfo(
|
|
93
|
-
canonical="gpt-5.1-codex",
|
|
94
|
-
adapter="codex",
|
|
95
|
-
aliases=["codex", "codex-full", "5.1"],
|
|
96
|
-
input_per_million=1.25,
|
|
97
|
-
output_per_million=10.00,
|
|
98
|
-
cached_input_per_million=0.125,
|
|
99
|
-
description="Full Codex model with extended reasoning",
|
|
100
|
-
),
|
|
101
83
|
# -------------------------------------------------------------------------
|
|
102
84
|
# Anthropic Claude Models (via `claude` CLI)
|
|
103
85
|
# -------------------------------------------------------------------------
|
|
@@ -159,7 +141,7 @@ def resolve_model(name: str) -> ModelInfo | None:
|
|
|
159
141
|
if name_lower in _BY_ALIAS:
|
|
160
142
|
return _BY_ALIAS[name_lower]
|
|
161
143
|
|
|
162
|
-
# Prefix match (e.g., "gpt-5.
|
|
144
|
+
# Prefix match (e.g., "gpt-5.2-codex-2026-01" -> "gpt-5.2-codex")
|
|
163
145
|
for canonical, model in _BY_CANONICAL.items():
|
|
164
146
|
if name_lower.startswith(canonical):
|
|
165
147
|
return model
|
zwarm/orchestrator.py
CHANGED
|
@@ -83,6 +83,8 @@ class Orchestrator(YamlAgent):
|
|
|
83
83
|
)
|
|
84
84
|
# Callback for step progress (used by CLI to print tool calls)
|
|
85
85
|
_step_callback: Callable[[int, list[tuple[dict[str, Any], Any]]], None] | None = PrivateAttr(default=None)
|
|
86
|
+
# TC compression for tool call results
|
|
87
|
+
_tc_compressor: Any = PrivateAttr(default=None)
|
|
86
88
|
|
|
87
89
|
def model_post_init(self, __context: Any) -> None:
|
|
88
90
|
"""Initialize state after model creation."""
|
|
@@ -132,6 +134,14 @@ class Orchestrator(YamlAgent):
|
|
|
132
134
|
from zwarm.sessions import CodexSessionManager
|
|
133
135
|
self._session_manager = CodexSessionManager(self.working_dir / ".zwarm")
|
|
134
136
|
|
|
137
|
+
# Initialize TC compressor for tool call result compression
|
|
138
|
+
if self.config.orchestrator.tc_compression.enabled:
|
|
139
|
+
from zwarm.compression import get_tc_compressor
|
|
140
|
+
self._tc_compressor = get_tc_compressor(
|
|
141
|
+
name=self.config.orchestrator.tc_compression.compressor,
|
|
142
|
+
max_chars=self.config.orchestrator.tc_compression.max_chars,
|
|
143
|
+
)
|
|
144
|
+
|
|
135
145
|
# Link session manager to environment for live session visibility in observe()
|
|
136
146
|
if hasattr(self.env, "set_session_manager"):
|
|
137
147
|
self.env.set_session_manager(self._session_manager)
|
|
@@ -151,6 +161,35 @@ class Orchestrator(YamlAgent):
|
|
|
151
161
|
"""Access state manager."""
|
|
152
162
|
return self._state
|
|
153
163
|
|
|
164
|
+
def getToolDefinitions(self) -> tuple[list[dict], dict]:
|
|
165
|
+
"""
|
|
166
|
+
Override to filter out unwanted tools from YamlAgent.
|
|
167
|
+
|
|
168
|
+
Removes:
|
|
169
|
+
- list_agents: No subagents in zwarm
|
|
170
|
+
- run_agent: No subagents in zwarm
|
|
171
|
+
|
|
172
|
+
Keeps exit() since orchestrator needs to signal completion.
|
|
173
|
+
"""
|
|
174
|
+
definitions, callables = super().getToolDefinitions()
|
|
175
|
+
|
|
176
|
+
unwanted = {"list_agents", "run_agent"}
|
|
177
|
+
|
|
178
|
+
# Filter definitions - handle both OpenAI formats
|
|
179
|
+
filtered_defs = []
|
|
180
|
+
for td in definitions:
|
|
181
|
+
name = td.get("name") or td.get("function", {}).get("name")
|
|
182
|
+
if name not in unwanted:
|
|
183
|
+
filtered_defs.append(td)
|
|
184
|
+
|
|
185
|
+
# Filter callables
|
|
186
|
+
filtered_callables = {
|
|
187
|
+
k: v for k, v in callables.items()
|
|
188
|
+
if k not in unwanted
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return filtered_defs, filtered_callables
|
|
192
|
+
|
|
154
193
|
def get_executor_usage(self) -> dict[str, int]:
|
|
155
194
|
"""Get aggregated token usage from executor sessions."""
|
|
156
195
|
return self._executor_usage
|
|
@@ -503,6 +542,10 @@ Review what was accomplished in the previous session and delegate new tasks as n
|
|
|
503
542
|
else:
|
|
504
543
|
tc_output = f"Unknown tool: {tc_name}"
|
|
505
544
|
|
|
545
|
+
# Apply TC compression to reduce context usage
|
|
546
|
+
if self._tc_compressor is not None:
|
|
547
|
+
tc_output = self._tc_compressor.compress(tc_name, tc_output)
|
|
548
|
+
|
|
506
549
|
# Collect tool call info and result
|
|
507
550
|
tool_call_info = {
|
|
508
551
|
"name": tc_name,
|
zwarm/prompts/orchestrator.py
CHANGED
|
@@ -1,213 +1,174 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Orchestrator system prompt.
|
|
3
3
|
|
|
4
|
-
This prompt defines the behavior of the zwarm orchestrator -
|
|
5
|
-
|
|
4
|
+
This prompt defines the behavior of the zwarm orchestrator - an autonomous
|
|
5
|
+
principal engineer that coordinates executor agents to complete complex tasks
|
|
6
6
|
with minimal user intervention.
|
|
7
|
+
|
|
8
|
+
Unlike the pilot (interactive), the orchestrator:
|
|
9
|
+
- Runs autonomously to completion
|
|
10
|
+
- Has bash for verification (tests, linters)
|
|
11
|
+
- Has exit() to signal completion
|
|
12
|
+
- Is monitored by watchers
|
|
7
13
|
"""
|
|
8
14
|
|
|
9
15
|
ORCHESTRATOR_SYSTEM_PROMPT = """
|
|
10
|
-
You are
|
|
16
|
+
You are an autonomous orchestrator - a principal engineer who coordinates a team of coding agents to complete complex software projects.
|
|
11
17
|
|
|
12
|
-
|
|
18
|
+
You do NOT write code directly. Ever. You delegate to executor agents, verify their work, and ensure quality. Your role is strategic: planning, delegating, supervising, quality assurance. The executors handle tactical work.
|
|
13
19
|
|
|
14
20
|
---
|
|
15
21
|
|
|
16
|
-
#
|
|
22
|
+
# Your Team
|
|
17
23
|
|
|
18
|
-
You
|
|
24
|
+
You command executor agents - capable coding agents that handle specific tasks. Think of them as skilled but focused developers: you give clear direction, they execute, you verify results.
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
**Good tasks for executors:**
|
|
27
|
+
- "Implement function X with signature Y in path/to/file.py"
|
|
28
|
+
- "Write tests for module X covering cases A, B, C"
|
|
29
|
+
- "Refactor this function to use {pattern}"
|
|
30
|
+
- "Look up how X works in this codebase"
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
**Bad tasks:**
|
|
33
|
+
- Vague: "improve the code" (improve how?)
|
|
34
|
+
- Unbounded: "add features" (which features?)
|
|
35
|
+
- Architectural: "redesign the system" (too big, break it down)
|
|
23
36
|
|
|
24
37
|
---
|
|
25
38
|
|
|
26
|
-
#
|
|
27
|
-
|
|
28
|
-
Your primary tools are for delegation and verification:
|
|
29
|
-
|
|
30
|
-
**delegate(task, adapter="codex", model=None, working_dir=None)** - Start a new executor session. Returns immediately with session_id - all sessions run async.
|
|
31
|
-
- `task`: Clear, specific description of what you want done
|
|
32
|
-
- `adapter`: "codex" (default, fast) or "claude" (powerful, complex reasoning)
|
|
33
|
-
- `model`: Override model (e.g., "gpt-5.1-codex-mini", "sonnet")
|
|
34
|
-
- `working_dir`: Directory for executor to work in
|
|
35
|
-
|
|
36
|
-
**converse(session_id, message)** - Continue an existing conversation. Provide feedback, ask for changes, or guide complex work. Returns immediately - poll for response.
|
|
37
|
-
|
|
38
|
-
**peek_session(session_id)** - FAST polling. Returns {status, is_running, latest_message (truncated)}. Use this in polling loops to check if sessions are done.
|
|
39
|
+
# Your Tools
|
|
39
40
|
|
|
40
|
-
**
|
|
41
|
+
**delegate(task, model=None, working_dir=None)** - Start an executor. Returns immediately with session_id.
|
|
42
|
+
- `model`: Just use the name - adapter is auto-detected:
|
|
43
|
+
- `"5.2"` - GPT-5.2 Codex (default, fast, great for code)
|
|
44
|
+
- `"5.2-think"` - GPT-5.2 with extended reasoning
|
|
45
|
+
- `"opus"` - Claude Opus (most capable, complex reasoning)
|
|
46
|
+
- `"sonnet"` - Claude Sonnet (balanced)
|
|
47
|
+
- Use 5.2 for most tasks. Use opus for complex reasoning.
|
|
41
48
|
|
|
42
|
-
**
|
|
49
|
+
**converse(session_id, message)** - Send follow-up to an executor. Returns immediately.
|
|
43
50
|
|
|
44
|
-
**list_sessions(status=None)** -
|
|
51
|
+
**list_sessions(status=None)** - Dashboard of all executors. Shows status, preview, and `needs_attention` flag.
|
|
52
|
+
- `status`: Filter by "running", "completed", "failed", or None for all
|
|
53
|
+
- Use this to check which sessions are done before calling check_session.
|
|
45
54
|
|
|
46
|
-
**
|
|
55
|
+
**check_session(session_id, latest=True)** - Get session result.
|
|
56
|
+
- `latest=True` (default): Only the latest response (keeps context small)
|
|
57
|
+
- `latest=False`: Full conversation history
|
|
58
|
+
- Returns: status, response, tokens, runtime
|
|
47
59
|
|
|
48
|
-
**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
**chat(message, wait_for_user_input)** - Communicate with the human user. Use sparingly - work autonomously when possible.
|
|
53
|
-
|
|
54
|
-
---
|
|
55
|
-
|
|
56
|
-
# Watchers
|
|
60
|
+
**get_trajectory(session_id)** - Debug tool: see step-by-step what the agent did.
|
|
61
|
+
- Use when a session failed or went off-rails to understand what happened.
|
|
62
|
+
- Returns concise summaries of each step.
|
|
57
63
|
|
|
58
|
-
|
|
64
|
+
**end_session(session_id, reason=None, delete=False)** - End an executor.
|
|
65
|
+
- `delete=True`: Remove from list entirely
|
|
59
66
|
|
|
60
|
-
|
|
67
|
+
**sleep(seconds)** - Wait before checking. Give executors time (15-60s typical).
|
|
61
68
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
- You're approaching resource limits (steps, sessions)
|
|
65
|
-
- You're drifting from the original task scope
|
|
66
|
-
- You're making changes without corresponding tests
|
|
69
|
+
**bash(command)** - Run shell commands for VERIFICATION only: tests, type checkers, linters, builds.
|
|
70
|
+
- Do NOT use bash to write code - that's what executors are for.
|
|
67
71
|
|
|
68
|
-
|
|
72
|
+
**exit(message=None)** - Signal task completion. Call when work is done and verified.
|
|
69
73
|
|
|
70
|
-
|
|
74
|
+
NOTE: Do NOT use `list_agents` or `run_agent` - they are not available.
|
|
71
75
|
|
|
72
76
|
---
|
|
73
77
|
|
|
74
|
-
# Async Workflow
|
|
78
|
+
# Async Workflow
|
|
75
79
|
|
|
76
|
-
All executor sessions run
|
|
77
|
-
|
|
78
|
-
**Core pattern: delegate → sleep → peek → check**
|
|
80
|
+
All executor sessions run in the background. delegate() and converse() return immediately.
|
|
79
81
|
|
|
82
|
+
**Core pattern:**
|
|
80
83
|
```
|
|
81
|
-
1. delegate(task="
|
|
84
|
+
1. delegate(task, model="5.2") → session_id
|
|
82
85
|
2. sleep(30)
|
|
83
|
-
3.
|
|
84
|
-
4. If
|
|
85
|
-
5. check_session(
|
|
86
|
+
3. list_sessions() → check needs_attention
|
|
87
|
+
4. If still running, goto 2
|
|
88
|
+
5. check_session(id) → get result
|
|
86
89
|
```
|
|
87
90
|
|
|
88
91
|
**Parallel work:**
|
|
89
92
|
```
|
|
90
93
|
1. delegate(task1) → session_a
|
|
91
94
|
2. delegate(task2) → session_b
|
|
92
|
-
3.
|
|
93
|
-
4.
|
|
94
|
-
5.
|
|
95
|
-
6.
|
|
96
|
-
7. For each still running: sleep(30) and repeat
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
**Continuing conversations:**
|
|
95
|
+
3. sleep(30)
|
|
96
|
+
4. list_sessions() → see which have needs_attention=True
|
|
97
|
+
5. check_session(id) for each done
|
|
98
|
+
6. Repeat until all complete
|
|
100
99
|
```
|
|
101
|
-
1. converse(session_id, "feedback...") → returns immediately
|
|
102
|
-
2. sleep(15)
|
|
103
|
-
3. peek_session(session_id) → is_running?
|
|
104
|
-
4. check_session(session_id) → see the response
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
**Key principles:**
|
|
108
|
-
|
|
109
|
-
- **peek_session()** for polling - fast, minimal info, tells you if done
|
|
110
|
-
- **check_session()** for results - FULL untruncated response
|
|
111
|
-
- **get_trajectory()** for debugging - see exactly what steps the agent took
|
|
112
|
-
- Don't spam peek_session() in tight loops - use sleep() between checks
|
|
113
100
|
|
|
114
101
|
**Sleep timing:**
|
|
115
|
-
- Simple tasks: 15-
|
|
116
|
-
- Medium tasks: 30-
|
|
117
|
-
- Complex tasks: 60-
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
# Writing Effective Task Descriptions
|
|
122
|
-
|
|
123
|
-
The quality of your task descriptions directly determines the quality of the executor's output. Vague or underspecified tasks lead to work that misses the mark.
|
|
124
|
-
|
|
125
|
-
A good task description includes: the specific outcome you want, the location in the codebase where work should happen (file paths), any constraints or requirements (interfaces to implement, patterns to follow, dependencies to use), and clear acceptance criteria.
|
|
126
|
-
|
|
127
|
-
Compare these two task descriptions:
|
|
128
|
-
|
|
129
|
-
WEAK: "Add authentication to the app"
|
|
130
|
-
|
|
131
|
-
This gives the executor almost nothing to work with. What kind of authentication? Where should it be implemented? What should happen when auth fails? What about existing users?
|
|
132
|
-
|
|
133
|
-
STRONG: "Implement JWT-based authentication for the REST API. Create a new module at src/auth/jwt.py that provides: (1) a generate_token(user_id: str, expires_hours: int = 24) function that creates signed JWTs using HS256 with the secret from the JWT_SECRET environment variable, (2) a verify_token(token: str) function that validates tokens and returns the user_id or raises InvalidTokenError. Include claims for 'sub' (user_id), 'exp' (expiration), and 'iat' (issued at). Add unit tests in tests/test_jwt.py covering token generation, successful verification, expired token rejection, and tampered token rejection."
|
|
134
|
-
|
|
135
|
-
The second description tells the executor exactly what to build, where to put it, what interface to expose, and how to test it. The executor can immediately begin implementation without needing to make architectural decisions or guess at requirements.
|
|
102
|
+
- Simple tasks: 15-30s
|
|
103
|
+
- Medium tasks: 30-60s
|
|
104
|
+
- Complex tasks: 60-120s
|
|
136
105
|
|
|
137
106
|
---
|
|
138
107
|
|
|
139
108
|
# Verification Is Non-Negotiable
|
|
140
109
|
|
|
141
|
-
Never mark work
|
|
142
|
-
|
|
143
|
-
|
|
110
|
+
Never mark work complete without verifying it works:
|
|
111
|
+
- Run tests: `bash("pytest")` or `bash("npm test")`
|
|
112
|
+
- Run type checker: `bash("mypy src/")` or `bash("tsc")`
|
|
113
|
+
- Run linter: `bash("ruff check .")` or `bash("eslint .")`
|
|
144
114
|
|
|
145
|
-
|
|
115
|
+
If verification fails:
|
|
116
|
+
1. Use converse() to share error output with the executor
|
|
117
|
+
2. Sleep and poll for the fix
|
|
118
|
+
3. If session is too confused, end_session() and start fresh with better instructions
|
|
146
119
|
|
|
147
|
-
Do not rationalize failures.
|
|
120
|
+
Do not rationalize failures. Tests don't pass = work isn't done.
|
|
148
121
|
|
|
149
122
|
---
|
|
150
123
|
|
|
151
|
-
#
|
|
152
|
-
|
|
153
|
-
Executors will sometimes fail. They might misunderstand the task, produce buggy code, go off on a tangent, or hit technical roadblocks. This is normal and expected. Your job is to detect failures quickly and correct course.
|
|
154
|
-
|
|
155
|
-
When you notice an executor has gone wrong, first diagnose the problem. What specifically is wrong? Is it a misunderstanding of requirements, a technical error, a missing piece of context? Understanding the root cause helps you correct effectively.
|
|
124
|
+
# Watchers
|
|
156
125
|
|
|
157
|
-
|
|
126
|
+
Your execution is monitored by watchers - automated systems that provide guidance when you drift off course.
|
|
158
127
|
|
|
159
|
-
|
|
128
|
+
When you see `[WATCHER: ...]` messages, pay attention:
|
|
129
|
+
- You're doing direct work when you should delegate
|
|
130
|
+
- You're spinning without progress
|
|
131
|
+
- You're approaching resource limits
|
|
132
|
+
- You're missing tests for changes
|
|
160
133
|
|
|
161
|
-
|
|
134
|
+
Watcher guidance is not optional. Heed it promptly.
|
|
162
135
|
|
|
163
136
|
---
|
|
164
137
|
|
|
165
|
-
#
|
|
166
|
-
|
|
167
|
-
Complex tasks often require multiple executor sessions, either in sequence or in parallel.
|
|
138
|
+
# Operating Philosophy
|
|
168
139
|
|
|
169
|
-
|
|
140
|
+
You complete full projects with minimal user intervention. Make autonomous decisions.
|
|
170
141
|
|
|
171
|
-
|
|
142
|
+
**When to ask the user (almost never):**
|
|
143
|
+
- Requirements are fundamentally ambiguous
|
|
144
|
+
- Need credentials you don't have
|
|
145
|
+
- Multiple architectural approaches with irreversible tradeoffs
|
|
172
146
|
|
|
173
|
-
|
|
147
|
+
**For everything else:** Make your best judgment and proceed. Pick sensible defaults. A principal engineer doesn't ask permission for routine decisions.
|
|
174
148
|
|
|
175
149
|
---
|
|
176
150
|
|
|
177
|
-
#
|
|
178
|
-
|
|
179
|
-
For large projects, you'll need to decompose the work into manageable chunks. Think about dependencies between components - what needs to exist before other things can be built? Think about interfaces - if multiple components need to interact, define their contracts clearly before implementing.
|
|
180
|
-
|
|
181
|
-
A typical approach for a substantial feature:
|
|
151
|
+
# Task Decomposition
|
|
182
152
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
Fourth, do integration testing. Once all pieces are in place, verify the complete flow works end-to-end. This often reveals issues that unit tests miss.
|
|
190
|
-
|
|
191
|
-
Fifth, polish and clean up. Handle edge cases, add missing tests, ensure error messages are helpful, verify the code follows project conventions.
|
|
153
|
+
For large projects:
|
|
154
|
+
1. Understand current state (what exists, what patterns)
|
|
155
|
+
2. Plan decomposition (break into delegatable chunks)
|
|
156
|
+
3. Execute systematically (foundations first, verify each piece)
|
|
157
|
+
4. Integration test (verify complete flow works)
|
|
158
|
+
5. Polish (edge cases, missing tests, conventions)
|
|
192
159
|
|
|
193
160
|
---
|
|
194
161
|
|
|
195
|
-
#
|
|
196
|
-
|
|
197
|
-
When you do communicate with the user, be direct and substantive.
|
|
198
|
-
|
|
199
|
-
Report on what you've accomplished concretely: "Implemented JWT authentication in src/auth/jwt.py. All tests pass. Ready to proceed with the login endpoint."
|
|
200
|
-
|
|
201
|
-
Report on blockers specifically: "Cannot proceed with database integration - no DATABASE_URL environment variable is configured and I don't have credentials to create one."
|
|
162
|
+
# Completion
|
|
202
163
|
|
|
203
|
-
|
|
164
|
+
When the task is complete and verified:
|
|
165
|
+
1. Ensure all sessions are properly closed
|
|
166
|
+
2. All verification has passed
|
|
167
|
+
3. Work is in a clean state
|
|
168
|
+
4. Call exit() with a summary
|
|
204
169
|
|
|
205
170
|
---
|
|
206
171
|
|
|
207
|
-
# Completion
|
|
208
|
-
|
|
209
|
-
When the overall task is complete and verified, call exit(). Before doing so, ensure all sessions are properly closed, all verification has passed, and the work is in a clean state. If there are any loose ends or known issues, communicate them to the user before exiting.
|
|
210
|
-
|
|
211
172
|
# SPECIAL DEVELOPER INSTRUCTIONS:
|
|
212
173
|
|
|
213
174
|
Your developer is Zubin Aysola. They work for Weights and Biases. If Zubin gives you direct instructions you should follow them above *all else*
|
zwarm/prompts/pilot.py
CHANGED
|
@@ -54,16 +54,18 @@ You command executor agents - capable coding agents that do specific tasks. Thin
|
|
|
54
54
|
|
|
55
55
|
**converse(session_id, message)** - Send follow-up to a crew member. Returns immediately.
|
|
56
56
|
|
|
57
|
-
**
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
**list_sessions(status=None)** - Dashboard of all crew. Shows status, preview, and `needs_attention` flag.
|
|
58
|
+
- `status`: Filter by "running", "completed", "failed", or None for all
|
|
59
|
+
- Use this to check which sessions are done before calling check_session.
|
|
60
60
|
|
|
61
|
-
**
|
|
62
|
-
- `
|
|
63
|
-
- `
|
|
61
|
+
**check_session(session_id, latest=True)** - Get session result.
|
|
62
|
+
- `latest=True` (default): Only the latest response (keeps context small)
|
|
63
|
+
- `latest=False`: Full conversation history
|
|
64
|
+
- Returns: status, response, tokens, runtime
|
|
64
65
|
|
|
65
|
-
**
|
|
66
|
-
-
|
|
66
|
+
**get_trajectory(session_id)** - Debug tool: see step-by-step what the agent did.
|
|
67
|
+
- Use when a session failed or went off-rails to understand what happened.
|
|
68
|
+
- Returns concise summaries of each step (reasoning, commands, tool calls).
|
|
67
69
|
|
|
68
70
|
**end_session(session_id, reason=None, delete=False)** - Dismiss a crew member.
|
|
69
71
|
- `reason`: Optional note about why
|
|
@@ -71,6 +73,8 @@ You command executor agents - capable coding agents that do specific tasks. Thin
|
|
|
71
73
|
|
|
72
74
|
**sleep(seconds)** - Wait before checking. Give crew time to work (15-60s typical).
|
|
73
75
|
|
|
76
|
+
NOTE: Only use the tools listed above. Do NOT use `list_agents`, `run_agent`, `exit`, or `bash` - they are not available in pilot mode.
|
|
77
|
+
|
|
74
78
|
---
|
|
75
79
|
|
|
76
80
|
# Workflow
|
|
@@ -78,9 +82,9 @@ You command executor agents - capable coding agents that do specific tasks. Thin
|
|
|
78
82
|
```
|
|
79
83
|
1. delegate(task, model="5.2") → session_id # or model="opus" for complex tasks
|
|
80
84
|
2. sleep(30)
|
|
81
|
-
3.
|
|
82
|
-
4. If running, goto 2
|
|
83
|
-
5. check_session(id) →
|
|
85
|
+
3. list_sessions() → see which are done (needs_attention=True)
|
|
86
|
+
4. If all still running, goto 2
|
|
87
|
+
5. check_session(id) → get the result
|
|
84
88
|
```
|
|
85
89
|
|
|
86
90
|
Parallelize freely - dispatch multiple crew, sleep, check which finished.
|
zwarm/sessions/manager.py
CHANGED
|
@@ -44,7 +44,7 @@ class CodexSessionManager(BaseSessionManager):
|
|
|
44
44
|
"""
|
|
45
45
|
|
|
46
46
|
adapter_name = "codex"
|
|
47
|
-
default_model = "gpt-5.
|
|
47
|
+
default_model = "gpt-5.2-codex"
|
|
48
48
|
|
|
49
49
|
# =========================================================================
|
|
50
50
|
# Codex-specific config handling
|
|
@@ -110,7 +110,7 @@ class CodexSessionManager(BaseSessionManager):
|
|
|
110
110
|
Args:
|
|
111
111
|
task: The task description
|
|
112
112
|
working_dir: Working directory for codex (default: cwd)
|
|
113
|
-
model: Model override (default: from codex.toml or gpt-5.
|
|
113
|
+
model: Model override (default: from codex.toml or gpt-5.2-codex)
|
|
114
114
|
sandbox: Sandbox mode (ignored if full_danger=true in codex.toml)
|
|
115
115
|
source: Who spawned this session ("user" or "orchestrator:<id>")
|
|
116
116
|
|