@llblab/pi-actors 0.46.1 → 0.48.0
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.
- package/AGENTS.md +7 -5
- package/BACKLOG.md +0 -582
- package/CHANGELOG.md +16 -0
- package/README.md +8 -1
- package/banner.jpg +0 -0
- package/dist/lib/prompts.d.ts +6 -5
- package/dist/lib/prompts.js +22 -23
- package/dist/lib/recipes-discovery.d.ts +4 -0
- package/dist/lib/recipes-discovery.js +13 -1
- package/dist/lib/recipes-references.js +10 -6
- package/dist/lib/registry.d.ts +15 -11
- package/dist/lib/registry.js +195 -25
- package/dist/lib/runtime.js +37 -2
- package/dist/lib/tools-inspect.js +156 -12
- package/dist/lib/tools-register.js +2 -1
- package/dist/lib/tools-response.js +5 -1
- package/dist/scripts/conformance.mjs +1 -0
- package/dist/skills/actors/SKILL.md +87 -65
- package/dist/skills/actors/references/diagnostics.md +44 -0
- package/dist/skills/actors/references/persistent-tools.md +74 -0
- package/dist/skills/actors/references/recipes.md +51 -0
- package/dist/skills/actors/references/runs.md +39 -0
- package/dist/skills/artifacts/SKILL.md +24 -7
- package/dist/skills/media/SKILL.md +35 -7
- package/dist/skills/project-work/SKILL.md +28 -7
- package/dist/skills/recipe-memory/SKILL.md +27 -7
- package/dist/skills/swarm/SKILL.md +56 -437
- package/dist/skills/swarm/references/development-swarm.md +118 -525
- package/dist/skills/swarm/references/review-swarms.md +115 -0
- package/docs/README.md +5 -5
- package/docs/recipe-library.md +15 -10
- package/docs/tool-registry.md +10 -4
- package/lib/prompts.ts +24 -24
- package/lib/recipes-discovery.ts +22 -1
- package/lib/recipes-references.ts +14 -6
- package/lib/registry.ts +288 -51
- package/lib/runtime.ts +41 -2
- package/lib/tools-inspect.ts +202 -10
- package/lib/tools-register.ts +4 -3
- package/lib/tools-response.ts +5 -1
- package/package.json +1 -1
- package/scripts/conformance.mjs +1 -0
- package/skills/actors/SKILL.md +87 -65
- package/skills/actors/references/diagnostics.md +44 -0
- package/skills/actors/references/persistent-tools.md +74 -0
- package/skills/actors/references/recipes.md +51 -0
- package/skills/actors/references/runs.md +39 -0
- package/skills/artifacts/SKILL.md +24 -7
- package/skills/media/SKILL.md +35 -7
- package/skills/project-work/SKILL.md +28 -7
- package/skills/recipe-memory/SKILL.md +27 -7
- package/skills/swarm/SKILL.md +56 -437
- package/skills/swarm/references/development-swarm.md +118 -525
- package/skills/swarm/references/review-swarms.md +115 -0
|
@@ -1,596 +1,189 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Development Swarms
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Use this reference when two or more implementation participants can own disjoint mutation zones and one integrator can reconcile them. Keep generic actor execution and lifecycle behavior in `actors`.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
It is intentionally lighter than a full orchestrator runtime.
|
|
5
|
+
## Admission test
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
Use a development swarm only when all are true:
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
- the accepted direction is stable enough to partition;
|
|
10
|
+
- each participant can receive a meaningful bounded scope;
|
|
11
|
+
- shared contracts have one named owner;
|
|
12
|
+
- work can be isolated from the shared target while in progress;
|
|
13
|
+
- one integrator owns merge order and final validation.
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
1 project
|
|
14
|
-
→ 1 shared backlog
|
|
15
|
-
→ 2–4 isolated worktrees or branches
|
|
16
|
-
→ each agent owns a small task card
|
|
17
|
-
→ conflicts trigger structured context exchange
|
|
18
|
-
→ one integrator merges
|
|
19
|
-
```
|
|
15
|
+
Do not parallelize implementation when tasks need the same central files, semantic ordering dominates wall-clock time, or the likely conflicts would invalidate the decomposition. Use planning or review first.
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
git worktree add ../agent-a -b agent/a-task
|
|
25
|
-
git worktree add ../agent-b -b agent/b-task
|
|
26
|
-
git worktree add ../agent-c -b agent/c-task
|
|
27
|
-
```
|
|
17
|
+
## Coordinator role separation
|
|
28
18
|
|
|
29
|
-
|
|
19
|
+
In a host-coordinator topology, the current Pi instance owns the declarative outcome and participant graph rather than acting as the default implementation worker. It may receive intent through Telegram or another companion extension, but transport does not become a gateway or gain hidden instance-creation authority; participant creation remains an explicit actor-kernel Run.
|
|
30
20
|
|
|
31
|
-
|
|
21
|
+
The coordinator should:
|
|
32
22
|
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
23
|
+
- Translate high-level intent into bounded task cards and dependency edges.
|
|
24
|
+
- Keep user authority, shared contracts, integration order, and final validation local.
|
|
25
|
+
- Remain available for checkpoints, permissions, conflicts, and changing evidence.
|
|
26
|
+
- Consume terminal handoffs, durable artifacts, and Trace attention instead of mirroring participant work.
|
|
27
|
+
- Check overdue work on an evidence-based timer; never replace event-driven completion with a rapid polling loop.
|
|
37
28
|
|
|
38
|
-
|
|
29
|
+
A participant should:
|
|
39
30
|
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
- No integrator is available.
|
|
31
|
+
- Own one concrete execution or evidence boundary.
|
|
32
|
+
- Avoid global orchestration and undeclared participant creation.
|
|
33
|
+
- Return a bounded handoff that lets the coordinator decide without replaying the entire task.
|
|
44
34
|
|
|
45
|
-
|
|
35
|
+
Use one ordinary Run under `actors` when only one worker is delegated. Activate this development-swarm protocol when two or more participants, parallel ownership, or explicit integration edges exist. Keep trivial single-boundary work inline when delegation overhead has no compensating value.
|
|
46
36
|
|
|
47
|
-
|
|
37
|
+
## Reasoning profiles
|
|
48
38
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
Agent D: integrate behavior
|
|
56
|
-
```
|
|
39
|
+
| Role | Default | Raise or fan out when |
|
|
40
|
+
| --- | --- | --- |
|
|
41
|
+
| Bounded implementation author | Reasoning off | The card explicitly owns unresolved diagnosis or design judgement |
|
|
42
|
+
| Reviewer | Medium reasoning, clean context | Stakes require independent lenses or repeated judges |
|
|
43
|
+
| Synthesizer / integrator | Medium reasoning | Evidence conflicts, shared contracts move, or merge order is semantic |
|
|
44
|
+
| Coordinator | Sufficient for decomposition and decisions | Scope, authority, or architecture remains unresolved |
|
|
57
45
|
|
|
58
|
-
|
|
46
|
+
Prefer independent review after implementation over asking one author thread to implement, retain all local assumptions, and then certify itself. When risk justifies the cost, use multiple independent reviewers: different lenses increase breadth, while repeated judges increase confidence. Preserve minority high-impact findings and merge only evidence-backed conclusions.
|
|
59
47
|
|
|
60
|
-
-
|
|
61
|
-
- `3 agents`: implementation; tests; docs plus review.
|
|
62
|
-
- `4 agents`: implementation; tests; docs/examples; integrator/refactor/audit.
|
|
48
|
+
More reviewers are not automatically better. Do not fan out when they would inspect unstable code, share contaminated context, repeat one unsupported claim, or exceed the value of the decision. Never change an already-running participant solely to enforce a newer profile; add a fresh review boundary if evidence remains open.
|
|
63
49
|
|
|
64
|
-
|
|
50
|
+
## Decompose by ownership
|
|
65
51
|
|
|
66
|
-
-
|
|
67
|
-
- `Test Agent`: writes tests and may expose bugs; avoids changing production logic.
|
|
68
|
-
- `Docs Agent`: updates docs/spec/examples/comments; avoids code.
|
|
69
|
-
- `Review/Integrator Agent`: reviews patches, resolves conflicts, runs checks, and merges.
|
|
70
|
-
|
|
71
|
-
Dangerous split:
|
|
52
|
+
Prefer mutation-zone ownership over broad feature labels.
|
|
72
53
|
|
|
73
54
|
```text
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
55
|
+
behavior owner → production behavior in one domain
|
|
56
|
+
test owner → regressions and fixtures for that domain
|
|
57
|
+
docs owner → affected agent/user contract
|
|
58
|
+
integrator → shared contracts, merge, final checks
|
|
78
59
|
```
|
|
79
60
|
|
|
80
|
-
|
|
61
|
+
A participant may own both behavior and its tests when separating them would force synchronized edits. What matters is one owner per writable surface and an explicit integration edge.
|
|
81
62
|
|
|
82
|
-
## Task
|
|
63
|
+
## Task card
|
|
83
64
|
|
|
84
|
-
Every
|
|
65
|
+
Every participant receives one task card before mutation:
|
|
85
66
|
|
|
86
67
|
```markdown
|
|
87
|
-
# Task
|
|
68
|
+
# Task Card
|
|
88
69
|
|
|
89
70
|
Goal:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
- Src/lib/stores/\*
|
|
102
|
-
|
|
103
|
-
Expected output:
|
|
104
|
-
|
|
105
|
-
- Patch
|
|
106
|
-
- Short summary
|
|
107
|
-
- Tests/checks run
|
|
108
|
-
- Touched files list
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
A task card should specify mutation zones, not just intent. The smaller the allowed file set, the less coordination machinery is needed.
|
|
112
|
-
|
|
113
|
-
Scope expansion is the main conflict generator. Agents must not opportunistically refactor unrelated code or silently edit outside the declared task. If an out-of-scope change is needed, write it as a new backlog item or ask the integrator to replan.
|
|
114
|
-
|
|
115
|
-
## Backlog Partitioning
|
|
116
|
-
|
|
117
|
-
Use explicit task IDs when a coordinator will split backlog work across agents. File position is too fragile once agents start editing, while stable IDs can appear in scope files, branch names, handoffs, and review reports.
|
|
118
|
-
|
|
119
|
-
Recommended task card shape:
|
|
120
|
-
|
|
121
|
-
```markdown
|
|
122
|
-
## T-001: Add trust warnings
|
|
123
|
-
|
|
124
|
-
Labels:
|
|
125
|
-
|
|
126
|
-
- Docs
|
|
127
|
-
- Runtime
|
|
128
|
-
|
|
129
|
-
Allowed files:
|
|
130
|
-
|
|
131
|
-
- Docs/command-templates.md
|
|
132
|
-
- Lib/schema.ts
|
|
133
|
-
|
|
134
|
-
Avoid files:
|
|
135
|
-
|
|
136
|
-
- Package.json
|
|
137
|
-
|
|
138
|
-
Exit:
|
|
139
|
-
|
|
140
|
-
- Docs explain the trusted executable boundary.
|
|
141
|
-
- Tests cover warning detection.
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
Partition by independent mutation zones first, then by effort. Do not split one shared public contract across agents unless a single integrator owns that contract. If task independence is uncertain, assign the risky task to the integrator or run a planning/review swarm before implementation.
|
|
145
|
-
|
|
146
|
-
## Collaborative Branch Subagents
|
|
147
|
-
|
|
148
|
-
Use this pattern when a coordinator needs 2-4 implementation agents to work from one backlog without sharing a mutable checkout.
|
|
149
|
-
|
|
150
|
-
```text
|
|
151
|
-
coordinator reads backlog
|
|
152
|
-
→ coordinator writes one scope file per agent
|
|
153
|
-
→ local async-run adapter starts isolated clone or worktree branches
|
|
154
|
-
→ each subagent works only inside its branch workspace
|
|
155
|
-
→ runner verifies commit and pushes branch
|
|
156
|
-
→ coordinator reviews ready branches
|
|
157
|
-
→ integrator merges through the normal project flow
|
|
71
|
+
Non-goals:
|
|
72
|
+
Allowed files or logical scope:
|
|
73
|
+
Avoided files or shared contracts:
|
|
74
|
+
Execution profile:
|
|
75
|
+
Isolation mode: exclusive paths | isolated worktree | artifact-only
|
|
76
|
+
Shared surfaces reserved for integrator:
|
|
77
|
+
Expected artifact or patch:
|
|
78
|
+
Required evidence:
|
|
79
|
+
Checks:
|
|
80
|
+
Escalate when:
|
|
81
|
+
Handoff destination:
|
|
158
82
|
```
|
|
159
83
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
Coordinator responsibilities:
|
|
163
|
-
|
|
164
|
-
1. Read the canonical backlog and project instructions.
|
|
165
|
-
2. Select independent task groups with stable task IDs.
|
|
166
|
-
3. Write one scope file per agent with goal, allowed files, avoided files, exit criteria, checks, and branch name.
|
|
167
|
-
4. Start the local async-run adapter.
|
|
168
|
-
5. Inspect run status and logs until terminal.
|
|
169
|
-
6. Review successful branch diffs before merge.
|
|
170
|
-
7. Record failed or out-of-scope work back into the backlog.
|
|
84
|
+
A useful task card names the smallest scope that can independently reach a validation boundary. It does not ask a participant to "help with" a broad project area. Participants must restate scope before editing and record discovered out-of-scope work rather than performing it.
|
|
171
85
|
|
|
172
|
-
|
|
86
|
+
`swarm/development-tasking` can generate and critique one card when the goal, allowed scope, avoided scope, checks, model, and tools are already known.
|
|
173
87
|
|
|
174
|
-
|
|
175
|
-
- Include task IDs and exact workspace path.
|
|
176
|
-
- Include allowed and avoided file lists.
|
|
177
|
-
- Require the agent to restate task IDs, allowed files, and exit criteria before editing.
|
|
178
|
-
- State that commit and push may be handled by the runner when the local adapter owns git finalization.
|
|
88
|
+
## Write ownership
|
|
179
89
|
|
|
180
|
-
|
|
90
|
+
- Give each writable file or logical contract one owner.
|
|
91
|
+
- Treat schemas, public APIs, central configuration, migrations, and specifications as exclusive even when textual merges look easy.
|
|
92
|
+
- Parallel readers may inspect a stable shared target.
|
|
93
|
+
- Isolate concurrent mutation through the repository's existing branch/workspace mechanism.
|
|
94
|
+
- Use bounded lock evidence when ownership is not otherwise obvious. A lock records intent; it does not authorize scope expansion.
|
|
95
|
+
- Release ownership at terminal handoff or explicitly transfer it through the integrator.
|
|
181
96
|
|
|
182
|
-
|
|
183
|
-
Work only in this repository workspace: <work_dir>.
|
|
184
|
-
Read your assigned scope from: <scope_file>.
|
|
185
|
-
Before editing, restate task IDs, allowed files, avoided files, and exit criteria.
|
|
186
|
-
Do not edit outside declared scope.
|
|
187
|
-
If an out-of-scope change is required, write it as a backlog note or handoff risk.
|
|
188
|
-
If blocked by a coordinator-only decision and the runtime supports checkpoints, emit a bounded Coordinator Checkpoint instead of discarding your context.
|
|
189
|
-
Run the checks named in the scope when practical.
|
|
190
|
-
Write a concise handoff report before finishing.
|
|
191
|
-
```
|
|
97
|
+
If a participant discovers that another scope must change, it emits a dependency or conflict report and stops that edge. The coordinator either transfers ownership, serializes the work, or replans.
|
|
192
98
|
|
|
193
|
-
##
|
|
99
|
+
## Isolation modes
|
|
194
100
|
|
|
195
|
-
|
|
101
|
+
- `Exclusive paths`: Writers share one worktree only when their complete writable path sets are disjoint and the shared baseline remains stable.
|
|
102
|
+
- `Isolated worktree`: Use when compilation, generated files, imports, or likely dependencies can touch shared repository state.
|
|
103
|
+
- `Artifact-only`: Use for reports, inventories, proposed patches, fixtures, or reviews that the integrator applies later.
|
|
196
104
|
|
|
197
|
-
|
|
105
|
+
The integrator exclusively owns `BACKLOG.md`, `CHANGELOG.md`, lockfiles, generated metadata, public schemas, release manifests, and cross-domain configuration by default. A task card may transfer one of these surfaces to another participant, but never create concurrent ownership. Authors report required shared-surface changes in handoff instead of applying them outside scope.
|
|
198
106
|
|
|
199
|
-
|
|
200
|
-
subagent reaches a decision gate
|
|
201
|
-
→ subagent emits Coordinator Checkpoint
|
|
202
|
-
→ runner pauses the subagent session without dropping context
|
|
203
|
-
→ coordinator answers the bounded question
|
|
204
|
-
→ runner resumes the same subagent context with the answer
|
|
205
|
-
→ subagent records the decision in its handoff
|
|
206
|
-
```
|
|
107
|
+
## Coordinator checkpoints
|
|
207
108
|
|
|
208
|
-
|
|
109
|
+
A checkpoint preserves useful local context while requesting one decision:
|
|
209
110
|
|
|
210
111
|
```markdown
|
|
211
112
|
# Coordinator Checkpoint
|
|
212
113
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
Workspace:
|
|
114
|
+
Task:
|
|
115
|
+
Current scope:
|
|
216
116
|
Question:
|
|
217
|
-
Why coordinator
|
|
218
|
-
Options
|
|
117
|
+
Why a coordinator decision is required:
|
|
118
|
+
Options and evidence:
|
|
219
119
|
Recommended option:
|
|
220
120
|
Risk if guessed:
|
|
221
|
-
State
|
|
121
|
+
State that must be preserved:
|
|
222
122
|
```
|
|
223
123
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
Coordinator prompt template:
|
|
124
|
+
Use checkpoints for scope changes, product choices, shared-contract decisions, permissions, or conflict policy. The coordinator answers only the bounded question. If the participant cannot resume with preserved context, retain the checkpoint as a handoff and start a clean replacement explicitly.
|
|
227
125
|
|
|
228
|
-
|
|
229
|
-
Read the project backlog and instructions.
|
|
230
|
-
Partition actionable work into <N> independent task groups.
|
|
231
|
-
Prefer groups with non-overlapping allowed files.
|
|
232
|
-
Write one scope file per agent under <run_dir>/scopes/.
|
|
233
|
-
Each scope file must include task IDs, goal, allowed files, avoided files, exit criteria, checks, branch name, and handoff path.
|
|
234
|
-
Do not start execution until every scope has a clear branch artifact contract.
|
|
235
|
-
```
|
|
126
|
+
## Handoff
|
|
236
127
|
|
|
237
|
-
|
|
128
|
+
Every participant returns:
|
|
238
129
|
|
|
239
130
|
```markdown
|
|
240
|
-
#
|
|
241
|
-
|
|
242
|
-
Run:
|
|
243
|
-
Branch:
|
|
244
|
-
Workspace:
|
|
245
|
-
Handoff path:
|
|
246
|
-
|
|
247
|
-
Task IDs:
|
|
248
|
-
|
|
249
|
-
- T-001
|
|
250
|
-
- T-002
|
|
251
|
-
|
|
252
|
-
Goal:
|
|
253
|
-
|
|
254
|
-
- ...
|
|
255
|
-
|
|
256
|
-
Allowed files:
|
|
257
|
-
|
|
258
|
-
- ...
|
|
259
|
-
|
|
260
|
-
Avoid files:
|
|
261
|
-
|
|
262
|
-
- ...
|
|
263
|
-
|
|
264
|
-
Exit criteria:
|
|
265
|
-
|
|
266
|
-
- ...
|
|
267
|
-
|
|
268
|
-
Checks:
|
|
269
|
-
|
|
270
|
-
- ...
|
|
271
|
-
|
|
272
|
-
Out-of-scope handling:
|
|
273
|
-
|
|
274
|
-
- Do not edit outside allowed files.
|
|
275
|
-
- Record required out-of-scope changes in the handoff risk section.
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
Branch artifact contract:
|
|
279
|
-
|
|
280
|
-
- Success means the expected branch exists, contains at least one commit for the assigned task group, and has been pushed.
|
|
281
|
-
- The branch name should include the run id and task range or agent id.
|
|
282
|
-
- The handoff report should name task IDs, touched files, checks, risks, and follow-up.
|
|
283
|
-
- A branch with no commit is not a successful artifact, even if the subagent exits with code 0.
|
|
284
|
-
|
|
285
|
-
Partial failure is normal. Treat a run with some ready branches and some failed branches as degraded, not as total failure. The coordinator should report ready branches, failed branches, failure reasons, and the safest next action for each failed scope.
|
|
286
|
-
|
|
287
|
-
## Soft-Lock Manifest
|
|
288
|
-
|
|
289
|
-
For 2–4 agents, start with a simple repository-local manifest rather than a lock server.
|
|
290
|
-
|
|
291
|
-
Suggested path:
|
|
292
|
-
|
|
293
|
-
```text
|
|
294
|
-
.agents/locks.md
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
Example:
|
|
298
|
-
|
|
299
|
-
```markdown
|
|
300
|
-
# Agent Locks
|
|
301
|
-
|
|
302
|
-
## agent-a
|
|
303
|
-
|
|
304
|
-
Task: fix scheduler tests
|
|
305
|
-
Owns:
|
|
306
|
-
|
|
307
|
-
- Pallets/aaa/src/tests/scheduler/\*
|
|
308
|
-
- Pallets/aaa/src/mock.rs
|
|
309
|
-
|
|
310
|
-
## agent-b
|
|
311
|
-
|
|
312
|
-
Task: update fee model docs
|
|
313
|
-
Owns:
|
|
314
|
-
|
|
315
|
-
- Docs/aaa/fees.md
|
|
316
|
-
- Docs/aaa/spec.md
|
|
317
|
-
|
|
318
|
-
## agent-c
|
|
319
|
-
|
|
320
|
-
Task: refactor frontend card component
|
|
321
|
-
Owns:
|
|
322
|
-
|
|
323
|
-
- Src/lib/components/Card.svelte
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
Protocol:
|
|
327
|
-
|
|
328
|
-
1. Read `.agents/locks.md` before starting.
|
|
329
|
-
2. Add or update your section before editing.
|
|
330
|
-
3. Treat `Owns:` as a soft write claim.
|
|
331
|
-
4. Avoid another agent's owned files unless the integrator replans.
|
|
332
|
-
5. On completion, remove the section or mark it done.
|
|
333
|
-
|
|
334
|
-
This manifest is weaker than an automated lock adapter but easier for humans and agents to inspect. Use a runtime-backed lock protocol when automation, TTL, or conflict enforcement is needed.
|
|
335
|
-
|
|
336
|
-
## Exclusive Files
|
|
337
|
-
|
|
338
|
-
Some files create semantic conflicts even when Git merges cleanly. Require exclusive ownership for public contracts and central runtime boundaries.
|
|
339
|
-
|
|
340
|
-
Examples:
|
|
341
|
-
|
|
342
|
-
```text
|
|
343
|
-
src/lib/types/*
|
|
344
|
-
pallets/*/src/lib.rs
|
|
345
|
-
runtime/src/*
|
|
346
|
-
docs/spec/*
|
|
347
|
-
package.json
|
|
348
|
-
Cargo.toml
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
Project-local protocol should define its own exclusive files. If a task needs one, assign it to a single agent or the integrator.
|
|
352
|
-
|
|
353
|
-
## Conflict Types
|
|
354
|
-
|
|
355
|
-
### Merge Conflict
|
|
356
|
-
|
|
357
|
-
Git cannot combine two edits to the same file.
|
|
358
|
-
|
|
359
|
-
Response:
|
|
360
|
-
|
|
361
|
-
1. Both agents produce conflict reports.
|
|
362
|
-
2. Resolver/integrator reads both reports.
|
|
363
|
-
3. Resolver merges patch.
|
|
364
|
-
4. Original agents review affected files only.
|
|
365
|
-
|
|
366
|
-
### Semantic Conflict
|
|
367
|
-
|
|
368
|
-
Files may merge, but meaning diverges. Example: one agent changes an API while another writes code against the old API.
|
|
369
|
-
|
|
370
|
-
Response:
|
|
371
|
-
|
|
372
|
-
1. Stop affected workers.
|
|
373
|
-
2. Integrator decides whether the backlog task is invalidated.
|
|
374
|
-
3. Split or replan before more implementation.
|
|
375
|
-
|
|
376
|
-
### Architecture Conflict
|
|
377
|
-
|
|
378
|
-
The task decomposition itself is wrong.
|
|
379
|
-
|
|
380
|
-
Response:
|
|
381
|
-
|
|
382
|
-
1. Stop workers on affected scopes.
|
|
383
|
-
2. Re-open planning.
|
|
384
|
-
3. Produce new task cards with corrected ownership.
|
|
385
|
-
|
|
386
|
-
## Conflict Handshake Protocol
|
|
387
|
-
|
|
388
|
-
Agents should not freely negotiate in long context-sharing threads. Exchange semantic deltas in a bounded format.
|
|
389
|
-
|
|
390
|
-
```markdown
|
|
391
|
-
# Conflict Report
|
|
392
|
-
|
|
393
|
-
Agent:
|
|
394
|
-
Task:
|
|
395
|
-
Conflicting files:
|
|
396
|
-
|
|
397
|
-
- ...
|
|
398
|
-
|
|
399
|
-
What I changed:
|
|
400
|
-
|
|
401
|
-
- ...
|
|
402
|
-
|
|
403
|
-
Why I changed it:
|
|
404
|
-
|
|
405
|
-
- ...
|
|
406
|
-
|
|
407
|
-
What I need preserved:
|
|
408
|
-
|
|
409
|
-
- ...
|
|
410
|
-
|
|
411
|
-
Can safely discard:
|
|
412
|
-
|
|
413
|
-
- ...
|
|
414
|
-
|
|
415
|
-
Suggested resolution:
|
|
416
|
-
|
|
417
|
-
- ...
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
Resolution flow:
|
|
421
|
-
|
|
422
|
-
```text
|
|
423
|
-
Agent A hits conflict with Agent B
|
|
424
|
-
→ Agent A writes Conflict Report
|
|
425
|
-
→ Agent B writes Conflict Report
|
|
426
|
-
→ Integrator/resolver reads both
|
|
427
|
-
→ Resolver creates merged patch
|
|
428
|
-
→ Original agents review only affected files
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
The goal is to exchange intent and invariants, not to let agents recursively debate.
|
|
432
|
-
|
|
433
|
-
## Scope Expansion Rule
|
|
434
|
-
|
|
435
|
-
Multi-agent work is stricter than solo work.
|
|
436
|
-
|
|
437
|
-
Required instruction for implementation agents:
|
|
438
|
-
|
|
439
|
-
```text
|
|
440
|
-
Do not opportunistically refactor unrelated code.
|
|
441
|
-
Do not modify files outside declared scope.
|
|
442
|
-
If you discover a needed out-of-scope change, record it as a backlog item or conflict note.
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
This is the difference between useful parallelism and diff chaos.
|
|
446
|
-
|
|
447
|
-
## Handoff Report
|
|
448
|
-
|
|
449
|
-
Each agent writes a concise handoff after finishing.
|
|
450
|
-
|
|
451
|
-
Suggested path:
|
|
452
|
-
|
|
453
|
-
```text
|
|
454
|
-
.agents/handoff/agent-a.md
|
|
455
|
-
```
|
|
456
|
-
|
|
457
|
-
Template:
|
|
458
|
-
|
|
459
|
-
```markdown
|
|
460
|
-
# Handoff: agent-a
|
|
131
|
+
# Handoff
|
|
461
132
|
|
|
462
133
|
Task:
|
|
463
|
-
|
|
464
|
-
|
|
134
|
+
Status: complete | degraded | blocked
|
|
465
135
|
Summary:
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
Tests/checks:
|
|
474
|
-
|
|
475
|
-
- ...
|
|
476
|
-
|
|
477
|
-
Behavior changes:
|
|
478
|
-
|
|
479
|
-
- ...
|
|
480
|
-
|
|
481
|
-
Risks / follow-up:
|
|
482
|
-
|
|
483
|
-
- ...
|
|
484
|
-
|
|
485
|
-
Integrator notes:
|
|
486
|
-
|
|
487
|
-
- What must be preserved during merge.
|
|
136
|
+
Touched scope:
|
|
137
|
+
Behavior or contract changes:
|
|
138
|
+
Checks and results:
|
|
139
|
+
Artifacts or patch identity:
|
|
140
|
+
Dependencies discovered:
|
|
141
|
+
Risks and unresolved questions:
|
|
142
|
+
Integrator invariants:
|
|
488
143
|
```
|
|
489
144
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
```markdown
|
|
493
|
-
# Agent A Handoff
|
|
494
|
-
|
|
495
|
-
Task:
|
|
496
|
-
A1: Add tests for scheduler window expiry
|
|
497
|
-
|
|
498
|
-
Touched files:
|
|
499
|
-
|
|
500
|
-
- Pallets/aaa/src/tests/scheduler/window.rs
|
|
145
|
+
A successful process exit without the expected patch, artifact, or evidence is not a successful handoff. Preserve partial work as degraded evidence when it is useful and safe to integrate.
|
|
501
146
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
- Added tests for inclusive window end.
|
|
505
|
-
- Added test for close only when current_block > end.
|
|
506
|
-
|
|
507
|
-
Checks:
|
|
147
|
+
## Conflict evidence
|
|
508
148
|
|
|
509
|
-
|
|
149
|
+
Distinguish three conflict classes:
|
|
510
150
|
|
|
511
|
-
|
|
151
|
+
- **Textual conflict:** edits overlap mechanically.
|
|
152
|
+
- **Semantic conflict:** edits merge but depend on incompatible meanings.
|
|
153
|
+
- **Architecture conflict:** the decomposition or accepted direction is wrong.
|
|
512
154
|
|
|
513
|
-
|
|
155
|
+
Each affected owner reports:
|
|
514
156
|
|
|
515
|
-
|
|
157
|
+
```markdown
|
|
158
|
+
# Conflict Report
|
|
516
159
|
|
|
517
|
-
|
|
160
|
+
Task and owned scope:
|
|
161
|
+
Conflicting scope:
|
|
162
|
+
Intent:
|
|
163
|
+
Invariant that must survive:
|
|
164
|
+
Change made:
|
|
165
|
+
Evidence:
|
|
166
|
+
Safe-to-discard portion:
|
|
167
|
+
Proposed resolution:
|
|
518
168
|
```
|
|
519
169
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
A local branch runner may be useful, but it is adapter policy rather than portable Swarm core. Keep concrete model names, tool allowlists, async-run syntax, and runtime-specific CLI invocation outside this skill.
|
|
523
|
-
|
|
524
|
-
Minimum runner behavior:
|
|
525
|
-
|
|
526
|
-
1. Clone or create an isolated worktree from the requested repo and base branch.
|
|
527
|
-
2. Create the expected feature branch.
|
|
528
|
-
3. Run one subagent with the prepared scope file and bounded tool access.
|
|
529
|
-
4. Verify the current branch is still the expected branch.
|
|
530
|
-
5. Verify there are intentional changes before commit.
|
|
531
|
-
6. Commit with a task-aware summary when the adapter owns git finalization.
|
|
532
|
-
7. Push the expected branch.
|
|
533
|
-
8. Emit a structured result with branch, commit, pushed status, handoff path, checks, and failure reason.
|
|
534
|
-
|
|
535
|
-
Recommended subagent tools are the smallest set that can complete the task, usually read, edit/write, and shell validation. Avoid broad external account tools inside implementation subagents. External actions such as opening pull requests, merging, publishing, or commenting belong to the coordinator or integrator after review.
|
|
536
|
-
|
|
537
|
-
Runner exit policy:
|
|
538
|
-
|
|
539
|
-
- Exit 0 only after commit verification and successful push when the runner owns git finalization.
|
|
540
|
-
- Exit non-zero when clone, checkout, subagent execution, commit verification, or push fails.
|
|
541
|
-
- A failed branch should not cancel sibling branches in the same async fanout.
|
|
542
|
-
- Timeouts should preserve logs and any handoff artifacts for coordinator inspection.
|
|
170
|
+
The integrator resolves from both reports. Architecture conflicts stop affected work and return to planning. Do not let participants recursively negotiate until their independent intent is lost.
|
|
543
171
|
|
|
544
|
-
##
|
|
172
|
+
## Integration protocol
|
|
545
173
|
|
|
546
|
-
The integrator
|
|
174
|
+
The named integrator:
|
|
547
175
|
|
|
548
|
-
|
|
176
|
+
1. freezes new author mutations and preserves every terminal handoff before integration;
|
|
177
|
+
2. reads task cards, handoffs, dependency edges, and conflict reports;
|
|
178
|
+
3. verifies each result stayed within scope;
|
|
179
|
+
4. integrates in dependency order, one ownership edge at a time;
|
|
180
|
+
5. resolves conflicts while preserving stated invariants;
|
|
181
|
+
6. runs checks after risky edges and the full agreed validation at the end;
|
|
182
|
+
7. obtains fresh review for conflict-resolved or shared-contract changes;
|
|
183
|
+
8. reports integrated tasks, rejected or deferred work, checks, and residual risks.
|
|
549
184
|
|
|
550
|
-
|
|
551
|
-
2. Merge one branch at a time.
|
|
552
|
-
3. Resolve conflicts using conflict reports, not guesses.
|
|
553
|
-
4. Run the project's validation gates.
|
|
554
|
-
5. Ask original agents to review affected files when conflict resolution changed their work.
|
|
555
|
-
6. Produce final summary: merged tasks, tests, touched files, residual risks.
|
|
185
|
+
Do not treat a clean merge, participant-local tests, or a collection of terminal Runs as integrated completion. Completion requires retained shared state plus coordinator-owned validation evidence.
|
|
556
186
|
|
|
557
|
-
##
|
|
558
|
-
|
|
559
|
-
```markdown
|
|
560
|
-
# Multi-Agent Protocol
|
|
561
|
-
|
|
562
|
-
1. Each agent MUST work in a separate branch or worktree.
|
|
563
|
-
2. Before editing, each agent MUST declare task, intended files, forbidden files, and expected output.
|
|
564
|
-
3. Agents SHOULD avoid files already claimed in `.agents/locks.md`.
|
|
565
|
-
4. Public API, storage, runtime, schema, and spec files require exclusive ownership.
|
|
566
|
-
5. Each agent MUST produce a handoff note after completion: touched files, semantic changes, checks run, unresolved risks.
|
|
567
|
-
6. If a conflict occurs, both agents MUST produce Conflict Reports.
|
|
568
|
-
7. Conflict resolution MUST preserve semantic intent, not merely compile.
|
|
569
|
-
8. Integrator merges patches into the shared target after checks pass.
|
|
570
|
-
9. No agent may silently expand task scope.
|
|
571
|
-
```
|
|
572
|
-
|
|
573
|
-
Context exchange rule:
|
|
574
|
-
|
|
575
|
-
```text
|
|
576
|
-
Before conflict: minimal shared context.
|
|
577
|
-
At conflict: compressed intent/diff/risk exchange.
|
|
578
|
-
After conflict: update backlog/locks.
|
|
579
|
-
```
|
|
580
|
-
|
|
581
|
-
Constant agent chat destroys independence. Conflict reports preserve the useful context without contaminating every worker.
|
|
582
|
-
|
|
583
|
-
## Minimal Directory
|
|
584
|
-
|
|
585
|
-
```text
|
|
586
|
-
.agents/
|
|
587
|
-
backlog.md
|
|
588
|
-
locks.md
|
|
589
|
-
protocol.md
|
|
590
|
-
handoff/
|
|
591
|
-
agent-a.md
|
|
592
|
-
agent-b.md
|
|
593
|
-
agent-c.md
|
|
594
|
-
```
|
|
187
|
+
## Stop conditions
|
|
595
188
|
|
|
596
|
-
|
|
189
|
+
Stop and replan when ownership overlaps, an exclusive contract lacks one owner, task cards cannot be independently validated, an out-of-scope dependency is required, architecture conflict appears, or no integrator can validate the retained result. Prefer a smaller serial cohort over parallel diff chaos.
|