agent-coordinator 1.0.0rc1__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.
- agent_coordinator-1.0.0rc1/LICENSE +21 -0
- agent_coordinator-1.0.0rc1/PKG-INFO +275 -0
- agent_coordinator-1.0.0rc1/README.md +248 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/__init__.py +3 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/__main__.py +5 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/application/__init__.py +1 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/application/prompt_builder.py +177 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/application/router.py +84 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/application/runner.py +52 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/application/task_service.py +157 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/cli.py +1140 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/domain/__init__.py +1 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/domain/lifecycle.py +73 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/domain/models.py +87 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/domain/retry_policy.py +51 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/handoff_parser.py +138 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/helpers/__init__.py +0 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/helpers/__main__.py +40 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/helpers/create_task.py +347 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/helpers/import_plan.py +511 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/__init__.py +1 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/claude_runner.py +57 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/copilot_runner.py +58 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/diagnostic_log.py +105 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/editor.py +254 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/enhanced_input.py +292 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/event_log.py +111 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/generic_runner.py +222 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/handoff_reader.py +32 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/human_prompt.py +356 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/manual_runner.py +76 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/opencode_runner.py +72 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/output_display.py +216 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/pty_utils.py +317 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/session_store.py +43 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/startup_cli.py +283 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/task_repository.py +86 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/infrastructure/tui.py +1252 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/models.py +16 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/prompts/agent_template.md +56 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/prompts/architect.md +117 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/prompts/developer.md +71 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/prompts/qa_engineer.md +73 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/prompts/shared_rules.md +23 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/task_store.py +38 -0
- agent_coordinator-1.0.0rc1/agent_coordinator/workflow.py +58 -0
- agent_coordinator-1.0.0rc1/agent_coordinator.egg-info/PKG-INFO +275 -0
- agent_coordinator-1.0.0rc1/agent_coordinator.egg-info/SOURCES.txt +88 -0
- agent_coordinator-1.0.0rc1/agent_coordinator.egg-info/dependency_links.txt +1 -0
- agent_coordinator-1.0.0rc1/agent_coordinator.egg-info/entry_points.txt +2 -0
- agent_coordinator-1.0.0rc1/agent_coordinator.egg-info/top_level.txt +1 -0
- agent_coordinator-1.0.0rc1/pyproject.toml +57 -0
- agent_coordinator-1.0.0rc1/setup.cfg +4 -0
- agent_coordinator-1.0.0rc1/tests/test_claude_runner.py +76 -0
- agent_coordinator-1.0.0rc1/tests/test_cli_coordinator_loop.py +268 -0
- agent_coordinator-1.0.0rc1/tests/test_cli_functions.py +246 -0
- agent_coordinator-1.0.0rc1/tests/test_coordinator_fixes.py +215 -0
- agent_coordinator-1.0.0rc1/tests/test_copilot_runner.py +83 -0
- agent_coordinator-1.0.0rc1/tests/test_diagnostic_log.py +89 -0
- agent_coordinator-1.0.0rc1/tests/test_editor.py +335 -0
- agent_coordinator-1.0.0rc1/tests/test_enhanced_input.py +339 -0
- agent_coordinator-1.0.0rc1/tests/test_event_log.py +181 -0
- agent_coordinator-1.0.0rc1/tests/test_generic_runner.py +174 -0
- agent_coordinator-1.0.0rc1/tests/test_generic_runner_extended.py +192 -0
- agent_coordinator-1.0.0rc1/tests/test_handoff_parser.py +149 -0
- agent_coordinator-1.0.0rc1/tests/test_handoff_parser_extended.py +221 -0
- agent_coordinator-1.0.0rc1/tests/test_handoff_reader.py +82 -0
- agent_coordinator-1.0.0rc1/tests/test_human_prompt.py +87 -0
- agent_coordinator-1.0.0rc1/tests/test_human_prompt_extended.py +156 -0
- agent_coordinator-1.0.0rc1/tests/test_import_plan.py +330 -0
- agent_coordinator-1.0.0rc1/tests/test_import_plan_extended.py +352 -0
- agent_coordinator-1.0.0rc1/tests/test_lifecycle.py +72 -0
- agent_coordinator-1.0.0rc1/tests/test_manual_runner.py +124 -0
- agent_coordinator-1.0.0rc1/tests/test_opencode_runner.py +73 -0
- agent_coordinator-1.0.0rc1/tests/test_prompt_builder.py +285 -0
- agent_coordinator-1.0.0rc1/tests/test_pty_utils.py +61 -0
- agent_coordinator-1.0.0rc1/tests/test_pty_utils_extended.py +203 -0
- agent_coordinator-1.0.0rc1/tests/test_retry_policy.py +49 -0
- agent_coordinator-1.0.0rc1/tests/test_router.py +78 -0
- agent_coordinator-1.0.0rc1/tests/test_runners.py +152 -0
- agent_coordinator-1.0.0rc1/tests/test_session_store.py +72 -0
- agent_coordinator-1.0.0rc1/tests/test_startup_cli.py +170 -0
- agent_coordinator-1.0.0rc1/tests/test_task_repository.py +112 -0
- agent_coordinator-1.0.0rc1/tests/test_task_service.py +133 -0
- agent_coordinator-1.0.0rc1/tests/test_task_service_status.py +100 -0
- agent_coordinator-1.0.0rc1/tests/test_task_state.py +110 -0
- agent_coordinator-1.0.0rc1/tests/test_tui.py +171 -0
- agent_coordinator-1.0.0rc1/tests/test_tui_rendering.py +276 -0
- agent_coordinator-1.0.0rc1/tests/test_visual_tui.py +92 -0
- agent_coordinator-1.0.0rc1/tests/test_workflow.py +139 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zoran Kucekovic
|
|
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.
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-coordinator
|
|
3
|
+
Version: 1.0.0rc1
|
|
4
|
+
Summary: Tool-agnostic multi-agent workflow coordinator. Orchestrate AI coding agents through a structured handoff protocol.
|
|
5
|
+
Author: Zoran Kucekovic
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/zkucekovic/agent-coordinator
|
|
8
|
+
Project-URL: Repository, https://github.com/zkucekovic/agent-coordinator
|
|
9
|
+
Project-URL: Issues, https://github.com/zkucekovic/agent-coordinator/issues
|
|
10
|
+
Keywords: multi-agent,ai,workflow,orchestration,opencode,claude,coding-agent
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
21
|
+
Classifier: Topic :: Software Development :: Testing
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# Agent Coordinator
|
|
29
|
+
|
|
30
|
+
Coordinate multiple AI coding agents — architect, developer, QA — on the same codebase. Agents pass work through `handoff.md`; the coordinator reads who's next, builds the prompt, dispatches to the backend, verifies the handoff, and repeats.
|
|
31
|
+
|
|
32
|
+
Works with [GitHub Copilot CLI](https://github.com/features/copilot), [Claude Code](https://docs.anthropic.com/en/docs/claude-code), [OpenCode](https://opencode.ai), or any CLI tool. Mix backends freely. Zero third-party dependencies.
|
|
33
|
+
|
|
34
|
+
Shared files:
|
|
35
|
+
- **`handoff.md`** — agent conversation history, append-only
|
|
36
|
+
- **`tasks.json`** — task state, updated automatically
|
|
37
|
+
- **`workflow_events.jsonl`** — audit log with timestamps
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install agent-coordinator
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
From source:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
git clone https://github.com/zkucekovic/agent-coordinator.git
|
|
49
|
+
cd agent-coordinator
|
|
50
|
+
pip install -e .
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Requires Python 3.10+. Install whichever backend CLI you plan to use.
|
|
54
|
+
|
|
55
|
+
## Quick start
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Import a spec and run
|
|
59
|
+
agent-coordinator --import SPECIFICATION.md --workspace ./my-project
|
|
60
|
+
agent-coordinator --workspace ./my-project
|
|
61
|
+
|
|
62
|
+
# Or import a plan with tasks already defined
|
|
63
|
+
agent-coordinator --import plan.md --workspace ./my-project
|
|
64
|
+
agent-coordinator --workspace ./my-project
|
|
65
|
+
|
|
66
|
+
# Or start from scratch — the coordinator creates an initial handoff
|
|
67
|
+
agent-coordinator --workspace ./my-project
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The default workflow: **architect** plans and reviews, **developer** implements, **QA engineer** validates.
|
|
71
|
+
|
|
72
|
+
## How it works
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
---HANDOFF---
|
|
76
|
+
ROLE: developer
|
|
77
|
+
STATUS: review_required
|
|
78
|
+
NEXT: architect
|
|
79
|
+
TASK_ID: task-001
|
|
80
|
+
TITLE: Implement login endpoint
|
|
81
|
+
SUMMARY: Added POST /auth/login with JWT signing. Used existing User model.
|
|
82
|
+
ACCEPTANCE:
|
|
83
|
+
- login endpoint returns a signed JWT — PASS
|
|
84
|
+
- input validation on email/password — PASS
|
|
85
|
+
CHANGED_FILES:
|
|
86
|
+
- src/auth/login.py
|
|
87
|
+
- tests/test_login.py
|
|
88
|
+
VALIDATION:
|
|
89
|
+
- python3 -m pytest tests/test_login.py -- 6 passed
|
|
90
|
+
BLOCKERS:
|
|
91
|
+
- none
|
|
92
|
+
---END---
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Each turn: read `NEXT:` → build prompt → dispatch → verify new block appended (retry if not) → sync `tasks.json` → log to `workflow_events.jsonl`.
|
|
96
|
+
|
|
97
|
+
### Status values
|
|
98
|
+
|
|
99
|
+
| Status | Effect |
|
|
100
|
+
|---|---|
|
|
101
|
+
| `continue` | Hand off to the next agent |
|
|
102
|
+
| `review_required` | Developer finished, architect should review |
|
|
103
|
+
| `rework_required` | Changes needed, back to developer |
|
|
104
|
+
| `approved` | Architect accepts the work |
|
|
105
|
+
| `blocked` | Cannot proceed, needs intervention |
|
|
106
|
+
| `needs_human` | Escalate to human operator |
|
|
107
|
+
| `plan_complete` | All work done, workflow ends |
|
|
108
|
+
|
|
109
|
+
### Task lifecycle
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
planned → in_engineering → ready_for_architect_review → done
|
|
113
|
+
↑ ↓
|
|
114
|
+
rework_requested ←── (architect decides)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Configuration
|
|
118
|
+
|
|
119
|
+
### agents.json
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"default_backend": "copilot",
|
|
124
|
+
"retry_policy": { "max_rework": 3, "on_exceed": "needs_human" },
|
|
125
|
+
"agents": {
|
|
126
|
+
"architect": {
|
|
127
|
+
"backend": "claude",
|
|
128
|
+
"model": "claude-sonnet-4",
|
|
129
|
+
"prompt_file": "prompts/architect.md"
|
|
130
|
+
},
|
|
131
|
+
"developer": {
|
|
132
|
+
"backend": "copilot",
|
|
133
|
+
"prompt_file": "prompts/developer.md"
|
|
134
|
+
},
|
|
135
|
+
"qa_engineer": {
|
|
136
|
+
"backend": "opencode",
|
|
137
|
+
"prompt_file": "prompts/qa_engineer.md"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Each agent can use a different backend. Built-in: `copilot`, `claude`, `opencode`, `manual` (human-in-the-loop). Any other value is resolved from PATH, or use `backend_config` for full control — see [docs/custom-backends.md](docs/custom-backends.md).
|
|
144
|
+
|
|
145
|
+
### CLI flags
|
|
146
|
+
|
|
147
|
+
| Flag | Default | Description |
|
|
148
|
+
|---|---|---|
|
|
149
|
+
| `--workspace PATH` | `workspace/` | Directory with handoff.md and project files |
|
|
150
|
+
| `--max-turns N` | `30` | Stop after N agent turns |
|
|
151
|
+
| `--reset` | | Clear saved sessions and start fresh |
|
|
152
|
+
| `--quiet` | | Suppress TUI output |
|
|
153
|
+
| `--output-lines N` | `10` | Agent output lines shown in TUI |
|
|
154
|
+
| `--no-streaming` | | Show output all at once instead of streaming |
|
|
155
|
+
| `--import FILE` | | Import a specification or plan into workspace |
|
|
156
|
+
| `--type spec\|plan` | auto | Force document type when importing |
|
|
157
|
+
| `--force` | | Overwrite existing files when importing |
|
|
158
|
+
|
|
159
|
+
### Project files
|
|
160
|
+
|
|
161
|
+
Drop these in your workspace to inject them into agent prompts on first turn:
|
|
162
|
+
|
|
163
|
+
- **Specification**: `SPECIFICATION.md`, `spec.md`, `PRD.md`, `requirements.md` (first match wins)
|
|
164
|
+
- **Plan**: `IMPLEMENTATION_PLAN.md`, `plan.md` (first match wins)
|
|
165
|
+
- **Project rules**: `AGENTS.md` — coding standards and conventions
|
|
166
|
+
|
|
167
|
+
### Sessions
|
|
168
|
+
|
|
169
|
+
Session IDs are saved in `<workspace>/.coordinator_sessions.json`. Re-running resumes where you left off. Use `--reset` to start clean.
|
|
170
|
+
|
|
171
|
+
## Interactive control
|
|
172
|
+
|
|
173
|
+
Press **Ctrl+C** during any turn:
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
c - Continue execution
|
|
177
|
+
r - Retry current turn
|
|
178
|
+
e - Edit handoff.md in $EDITOR
|
|
179
|
+
m - Add message to handoff
|
|
180
|
+
i - Inspect current state
|
|
181
|
+
q - Quit
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
The workflow also pauses automatically on `NEXT: human` or when `max_rework` is exceeded.
|
|
185
|
+
|
|
186
|
+
## Adding agents
|
|
187
|
+
|
|
188
|
+
No code changes needed. Create a prompt file, add the agent to `agents.json`, and route to it by writing `NEXT: <role>` in a handoff block.
|
|
189
|
+
|
|
190
|
+
```json
|
|
191
|
+
"security_reviewer": {
|
|
192
|
+
"backend": "claude",
|
|
193
|
+
"prompt_file": "prompts/security_reviewer.md"
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Adding backends
|
|
198
|
+
|
|
199
|
+
For CLI tools, use `backend_config` in `agents.json` — no Python needed:
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
"developer": {
|
|
203
|
+
"backend": "custom",
|
|
204
|
+
"backend_config": {
|
|
205
|
+
"command": ["my-cli", "run"],
|
|
206
|
+
"message_arg": "{message}",
|
|
207
|
+
"workspace_arg": ["--dir", "{workspace}"],
|
|
208
|
+
"session_arg": ["--session", "{session_id}"],
|
|
209
|
+
"output_format": "json",
|
|
210
|
+
"json_text_field": "result"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Or implement the `AgentRunner` interface in Python:
|
|
216
|
+
|
|
217
|
+
```python
|
|
218
|
+
from agent_coordinator.application.runner import AgentRunner
|
|
219
|
+
from agent_coordinator.domain.models import RunResult
|
|
220
|
+
|
|
221
|
+
class MyRunner(AgentRunner):
|
|
222
|
+
def run(self, message, workspace, session_id=None, model=None, on_output=None):
|
|
223
|
+
response = call_my_tool(message)
|
|
224
|
+
return RunResult(session_id="some-id", text=response)
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Register in `agent_coordinator/cli.py` and reference as `"backend": "my_runner"` in agents.json.
|
|
228
|
+
|
|
229
|
+
## Retry behavior
|
|
230
|
+
|
|
231
|
+
If an agent doesn't update `handoff.md`, the coordinator retries with a reminder. If `max_rework` is exceeded, it escalates per the `on_exceed` policy.
|
|
232
|
+
|
|
233
|
+
## Demo
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
agent-coordinator --workspace examples/tetris-demo --max-turns 30
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Builds a playable HTML Tetris game through the full architect → developer → QA loop. See [examples/tetris-demo/](examples/tetris-demo/).
|
|
240
|
+
|
|
241
|
+
## Tests
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
python3 -m unittest discover tests/ -v # unit tests
|
|
245
|
+
python3 -m unittest tests.test_handoff_parser -v # single file
|
|
246
|
+
RUN_INTEGRATION_TESTS=1 python3 -m unittest discover tests/integration/ -v # requires API tokens
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## Project structure
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
agent_coordinator/
|
|
253
|
+
cli.py entry point and orchestration loop
|
|
254
|
+
domain/ models, task lifecycle, retry policy (no I/O)
|
|
255
|
+
application/ router, prompt builder, task service, runner interface
|
|
256
|
+
infrastructure/ backend runners, PTY subprocess, TUI, file I/O
|
|
257
|
+
handoff_parser.py regex parser for handoff blocks
|
|
258
|
+
prompts/ role instructions and shared protocol rules
|
|
259
|
+
helpers/ import/export utilities
|
|
260
|
+
tests/ unit and integration tests
|
|
261
|
+
docs/ protocol spec, workflow details, backend guide
|
|
262
|
+
examples/ tetris demo, sample configs
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Further reading
|
|
266
|
+
|
|
267
|
+
- [ARCHITECTURE.md](ARCHITECTURE.md) — hexagonal design, data flow, extension points
|
|
268
|
+
- [docs/protocol.md](docs/protocol.md) — handoff block specification
|
|
269
|
+
- [docs/workflow.md](docs/workflow.md) — coordinator loop and task lifecycle
|
|
270
|
+
- [docs/custom-backends.md](docs/custom-backends.md) — any CLI as a backend
|
|
271
|
+
- [docs/interactive-control.md](docs/interactive-control.md) — Ctrl+C menu and human intervention
|
|
272
|
+
|
|
273
|
+
## License
|
|
274
|
+
|
|
275
|
+
MIT
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# Agent Coordinator
|
|
2
|
+
|
|
3
|
+
Coordinate multiple AI coding agents — architect, developer, QA — on the same codebase. Agents pass work through `handoff.md`; the coordinator reads who's next, builds the prompt, dispatches to the backend, verifies the handoff, and repeats.
|
|
4
|
+
|
|
5
|
+
Works with [GitHub Copilot CLI](https://github.com/features/copilot), [Claude Code](https://docs.anthropic.com/en/docs/claude-code), [OpenCode](https://opencode.ai), or any CLI tool. Mix backends freely. Zero third-party dependencies.
|
|
6
|
+
|
|
7
|
+
Shared files:
|
|
8
|
+
- **`handoff.md`** — agent conversation history, append-only
|
|
9
|
+
- **`tasks.json`** — task state, updated automatically
|
|
10
|
+
- **`workflow_events.jsonl`** — audit log with timestamps
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install agent-coordinator
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
From source:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
git clone https://github.com/zkucekovic/agent-coordinator.git
|
|
22
|
+
cd agent-coordinator
|
|
23
|
+
pip install -e .
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Requires Python 3.10+. Install whichever backend CLI you plan to use.
|
|
27
|
+
|
|
28
|
+
## Quick start
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Import a spec and run
|
|
32
|
+
agent-coordinator --import SPECIFICATION.md --workspace ./my-project
|
|
33
|
+
agent-coordinator --workspace ./my-project
|
|
34
|
+
|
|
35
|
+
# Or import a plan with tasks already defined
|
|
36
|
+
agent-coordinator --import plan.md --workspace ./my-project
|
|
37
|
+
agent-coordinator --workspace ./my-project
|
|
38
|
+
|
|
39
|
+
# Or start from scratch — the coordinator creates an initial handoff
|
|
40
|
+
agent-coordinator --workspace ./my-project
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The default workflow: **architect** plans and reviews, **developer** implements, **QA engineer** validates.
|
|
44
|
+
|
|
45
|
+
## How it works
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
---HANDOFF---
|
|
49
|
+
ROLE: developer
|
|
50
|
+
STATUS: review_required
|
|
51
|
+
NEXT: architect
|
|
52
|
+
TASK_ID: task-001
|
|
53
|
+
TITLE: Implement login endpoint
|
|
54
|
+
SUMMARY: Added POST /auth/login with JWT signing. Used existing User model.
|
|
55
|
+
ACCEPTANCE:
|
|
56
|
+
- login endpoint returns a signed JWT — PASS
|
|
57
|
+
- input validation on email/password — PASS
|
|
58
|
+
CHANGED_FILES:
|
|
59
|
+
- src/auth/login.py
|
|
60
|
+
- tests/test_login.py
|
|
61
|
+
VALIDATION:
|
|
62
|
+
- python3 -m pytest tests/test_login.py -- 6 passed
|
|
63
|
+
BLOCKERS:
|
|
64
|
+
- none
|
|
65
|
+
---END---
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Each turn: read `NEXT:` → build prompt → dispatch → verify new block appended (retry if not) → sync `tasks.json` → log to `workflow_events.jsonl`.
|
|
69
|
+
|
|
70
|
+
### Status values
|
|
71
|
+
|
|
72
|
+
| Status | Effect |
|
|
73
|
+
|---|---|
|
|
74
|
+
| `continue` | Hand off to the next agent |
|
|
75
|
+
| `review_required` | Developer finished, architect should review |
|
|
76
|
+
| `rework_required` | Changes needed, back to developer |
|
|
77
|
+
| `approved` | Architect accepts the work |
|
|
78
|
+
| `blocked` | Cannot proceed, needs intervention |
|
|
79
|
+
| `needs_human` | Escalate to human operator |
|
|
80
|
+
| `plan_complete` | All work done, workflow ends |
|
|
81
|
+
|
|
82
|
+
### Task lifecycle
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
planned → in_engineering → ready_for_architect_review → done
|
|
86
|
+
↑ ↓
|
|
87
|
+
rework_requested ←── (architect decides)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Configuration
|
|
91
|
+
|
|
92
|
+
### agents.json
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"default_backend": "copilot",
|
|
97
|
+
"retry_policy": { "max_rework": 3, "on_exceed": "needs_human" },
|
|
98
|
+
"agents": {
|
|
99
|
+
"architect": {
|
|
100
|
+
"backend": "claude",
|
|
101
|
+
"model": "claude-sonnet-4",
|
|
102
|
+
"prompt_file": "prompts/architect.md"
|
|
103
|
+
},
|
|
104
|
+
"developer": {
|
|
105
|
+
"backend": "copilot",
|
|
106
|
+
"prompt_file": "prompts/developer.md"
|
|
107
|
+
},
|
|
108
|
+
"qa_engineer": {
|
|
109
|
+
"backend": "opencode",
|
|
110
|
+
"prompt_file": "prompts/qa_engineer.md"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Each agent can use a different backend. Built-in: `copilot`, `claude`, `opencode`, `manual` (human-in-the-loop). Any other value is resolved from PATH, or use `backend_config` for full control — see [docs/custom-backends.md](docs/custom-backends.md).
|
|
117
|
+
|
|
118
|
+
### CLI flags
|
|
119
|
+
|
|
120
|
+
| Flag | Default | Description |
|
|
121
|
+
|---|---|---|
|
|
122
|
+
| `--workspace PATH` | `workspace/` | Directory with handoff.md and project files |
|
|
123
|
+
| `--max-turns N` | `30` | Stop after N agent turns |
|
|
124
|
+
| `--reset` | | Clear saved sessions and start fresh |
|
|
125
|
+
| `--quiet` | | Suppress TUI output |
|
|
126
|
+
| `--output-lines N` | `10` | Agent output lines shown in TUI |
|
|
127
|
+
| `--no-streaming` | | Show output all at once instead of streaming |
|
|
128
|
+
| `--import FILE` | | Import a specification or plan into workspace |
|
|
129
|
+
| `--type spec\|plan` | auto | Force document type when importing |
|
|
130
|
+
| `--force` | | Overwrite existing files when importing |
|
|
131
|
+
|
|
132
|
+
### Project files
|
|
133
|
+
|
|
134
|
+
Drop these in your workspace to inject them into agent prompts on first turn:
|
|
135
|
+
|
|
136
|
+
- **Specification**: `SPECIFICATION.md`, `spec.md`, `PRD.md`, `requirements.md` (first match wins)
|
|
137
|
+
- **Plan**: `IMPLEMENTATION_PLAN.md`, `plan.md` (first match wins)
|
|
138
|
+
- **Project rules**: `AGENTS.md` — coding standards and conventions
|
|
139
|
+
|
|
140
|
+
### Sessions
|
|
141
|
+
|
|
142
|
+
Session IDs are saved in `<workspace>/.coordinator_sessions.json`. Re-running resumes where you left off. Use `--reset` to start clean.
|
|
143
|
+
|
|
144
|
+
## Interactive control
|
|
145
|
+
|
|
146
|
+
Press **Ctrl+C** during any turn:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
c - Continue execution
|
|
150
|
+
r - Retry current turn
|
|
151
|
+
e - Edit handoff.md in $EDITOR
|
|
152
|
+
m - Add message to handoff
|
|
153
|
+
i - Inspect current state
|
|
154
|
+
q - Quit
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
The workflow also pauses automatically on `NEXT: human` or when `max_rework` is exceeded.
|
|
158
|
+
|
|
159
|
+
## Adding agents
|
|
160
|
+
|
|
161
|
+
No code changes needed. Create a prompt file, add the agent to `agents.json`, and route to it by writing `NEXT: <role>` in a handoff block.
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
"security_reviewer": {
|
|
165
|
+
"backend": "claude",
|
|
166
|
+
"prompt_file": "prompts/security_reviewer.md"
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Adding backends
|
|
171
|
+
|
|
172
|
+
For CLI tools, use `backend_config` in `agents.json` — no Python needed:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
"developer": {
|
|
176
|
+
"backend": "custom",
|
|
177
|
+
"backend_config": {
|
|
178
|
+
"command": ["my-cli", "run"],
|
|
179
|
+
"message_arg": "{message}",
|
|
180
|
+
"workspace_arg": ["--dir", "{workspace}"],
|
|
181
|
+
"session_arg": ["--session", "{session_id}"],
|
|
182
|
+
"output_format": "json",
|
|
183
|
+
"json_text_field": "result"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Or implement the `AgentRunner` interface in Python:
|
|
189
|
+
|
|
190
|
+
```python
|
|
191
|
+
from agent_coordinator.application.runner import AgentRunner
|
|
192
|
+
from agent_coordinator.domain.models import RunResult
|
|
193
|
+
|
|
194
|
+
class MyRunner(AgentRunner):
|
|
195
|
+
def run(self, message, workspace, session_id=None, model=None, on_output=None):
|
|
196
|
+
response = call_my_tool(message)
|
|
197
|
+
return RunResult(session_id="some-id", text=response)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Register in `agent_coordinator/cli.py` and reference as `"backend": "my_runner"` in agents.json.
|
|
201
|
+
|
|
202
|
+
## Retry behavior
|
|
203
|
+
|
|
204
|
+
If an agent doesn't update `handoff.md`, the coordinator retries with a reminder. If `max_rework` is exceeded, it escalates per the `on_exceed` policy.
|
|
205
|
+
|
|
206
|
+
## Demo
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
agent-coordinator --workspace examples/tetris-demo --max-turns 30
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Builds a playable HTML Tetris game through the full architect → developer → QA loop. See [examples/tetris-demo/](examples/tetris-demo/).
|
|
213
|
+
|
|
214
|
+
## Tests
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
python3 -m unittest discover tests/ -v # unit tests
|
|
218
|
+
python3 -m unittest tests.test_handoff_parser -v # single file
|
|
219
|
+
RUN_INTEGRATION_TESTS=1 python3 -m unittest discover tests/integration/ -v # requires API tokens
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Project structure
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
agent_coordinator/
|
|
226
|
+
cli.py entry point and orchestration loop
|
|
227
|
+
domain/ models, task lifecycle, retry policy (no I/O)
|
|
228
|
+
application/ router, prompt builder, task service, runner interface
|
|
229
|
+
infrastructure/ backend runners, PTY subprocess, TUI, file I/O
|
|
230
|
+
handoff_parser.py regex parser for handoff blocks
|
|
231
|
+
prompts/ role instructions and shared protocol rules
|
|
232
|
+
helpers/ import/export utilities
|
|
233
|
+
tests/ unit and integration tests
|
|
234
|
+
docs/ protocol spec, workflow details, backend guide
|
|
235
|
+
examples/ tetris demo, sample configs
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Further reading
|
|
239
|
+
|
|
240
|
+
- [ARCHITECTURE.md](ARCHITECTURE.md) — hexagonal design, data flow, extension points
|
|
241
|
+
- [docs/protocol.md](docs/protocol.md) — handoff block specification
|
|
242
|
+
- [docs/workflow.md](docs/workflow.md) — coordinator loop and task lifecycle
|
|
243
|
+
- [docs/custom-backends.md](docs/custom-backends.md) — any CLI as a backend
|
|
244
|
+
- [docs/interactive-control.md](docs/interactive-control.md) — Ctrl+C menu and human intervention
|
|
245
|
+
|
|
246
|
+
## License
|
|
247
|
+
|
|
248
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Application layer — use cases and orchestration. No direct I/O."""
|