@syntesseraai/opencode-feature-factory 0.4.6 → 0.5.1
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/README.md +32 -0
- package/agents/building.md +15 -1
- package/agents/planning.md +18 -3
- package/agents/reviewing.md +19 -4
- package/package.json +1 -1
- package/skills/ff-learning/SKILL.md +31 -34
- package/skills/ff-swarm/SKILL.md +209 -0
package/README.md
CHANGED
|
@@ -82,6 +82,38 @@ All agents output structured JSON for consistent parsing:
|
|
|
82
82
|
- Review/audit agents: `{ approved, confidence, findings[], recommendations[], ... }`
|
|
83
83
|
- Acceptance: `{ accepted, criteriaMet[], criteriaNotMet[], ... }`
|
|
84
84
|
|
|
85
|
+
## Release Process
|
|
86
|
+
|
|
87
|
+
To publish a new version of `@syntesseraai/opencode-feature-factory`:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# 1. Clean the build output
|
|
91
|
+
rm -rf packages/opencode-plugin/dist
|
|
92
|
+
|
|
93
|
+
# 2. Bump the version in package.json
|
|
94
|
+
# Edit packages/opencode-plugin/package.json and increment "version"
|
|
95
|
+
# e.g. "0.4.6" → "0.4.7" (patch), "0.5.0" (minor), "1.0.0" (major)
|
|
96
|
+
|
|
97
|
+
# 3. Rebuild the package
|
|
98
|
+
cd packages/opencode-plugin && npx tsc && cd ../..
|
|
99
|
+
|
|
100
|
+
# 4. Commit the changes
|
|
101
|
+
git add packages/opencode-plugin/
|
|
102
|
+
git commit -m "chore: bump opencode-plugin to vX.Y.Z"
|
|
103
|
+
|
|
104
|
+
# 5. Push to remote
|
|
105
|
+
git push
|
|
106
|
+
|
|
107
|
+
# 6. Publish to npm
|
|
108
|
+
cd packages/opencode-plugin && npm publish --access public && cd ../..
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Notes:**
|
|
112
|
+
|
|
113
|
+
- The `dist/` directory must be deleted before rebuilding to ensure stale artifacts are removed.
|
|
114
|
+
- The `npm publish --access public` flag is required because the package uses an `@syntesseraai` scope.
|
|
115
|
+
- Verify the build output in `dist/` looks correct before publishing.
|
|
116
|
+
|
|
85
117
|
## License
|
|
86
118
|
|
|
87
119
|
MIT
|
package/agents/building.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Implements features and makes code changes based on implementation plans. Use this agent to execute plans, write code, and build features. Prefer delegation for validation, testing, and documentation.
|
|
3
|
-
mode: primary
|
|
4
3
|
color: '#10b981'
|
|
5
4
|
tools:
|
|
6
5
|
read: true
|
|
@@ -14,6 +13,7 @@ permission:
|
|
|
14
13
|
'*': allow
|
|
15
14
|
task:
|
|
16
15
|
'ff-*': allow
|
|
16
|
+
building: allow
|
|
17
17
|
planning: allow
|
|
18
18
|
reviewing: allow
|
|
19
19
|
edit: allow
|
|
@@ -233,6 +233,20 @@ Before implementing:
|
|
|
233
233
|
4. Save time and ensure consistency
|
|
234
234
|
```
|
|
235
235
|
|
|
236
|
+
## Swarm Mode (Parallel Self-Delegation)
|
|
237
|
+
|
|
238
|
+
When the user says **"build in parallel"**, **"delegate"**, **"swarm"**, **"split this up"**, or **"parallelize"**:
|
|
239
|
+
|
|
240
|
+
1. **Load the ff-swarm skill** immediately
|
|
241
|
+
2. **Become a coordinator** — stop doing implementation work yourself
|
|
242
|
+
3. **Partition** the task into independent, non-overlapping units
|
|
243
|
+
4. **Spawn sub-agents of yourself** (`building`) for each partition via the Task tool
|
|
244
|
+
5. **Monitor, aggregate, and report** the unified result
|
|
245
|
+
|
|
246
|
+
This is different from normal delegation (ff-delegation), which sends work to _different_ agent types. Swarm mode creates copies of _yourself_ to parallelize the same type of work.
|
|
247
|
+
|
|
248
|
+
See the `ff-swarm` skill for full process details, partitioning rules, and guardrails.
|
|
249
|
+
|
|
236
250
|
## Delegation Strategy
|
|
237
251
|
|
|
238
252
|
ALWAYS prefer delegation. Parallelize these tasks:
|
package/agents/planning.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Creates comprehensive implementation plans before making any code changes. Use this agent to analyze requirements, break down tasks, and create detailed implementation plans. Can delegate to read-only sub-agents for parallel research and validation.
|
|
3
|
-
mode: primary
|
|
4
3
|
color: '#3b82f6'
|
|
5
4
|
tools:
|
|
6
5
|
read: true
|
|
@@ -14,6 +13,7 @@ permission:
|
|
|
14
13
|
'*': allow
|
|
15
14
|
task:
|
|
16
15
|
'ff-*': allow
|
|
16
|
+
planning: allow
|
|
17
17
|
explore: allow
|
|
18
18
|
general: deny
|
|
19
19
|
# File tools - agents directory (read/write for own context)
|
|
@@ -73,8 +73,8 @@ At the start of EVERY planning task:
|
|
|
73
73
|
5. **Load the ff-delegation skill** and assess parallelization opportunities
|
|
74
74
|
6. **Load the ff-mini-plan skill** and assess task complexity
|
|
75
75
|
7. **Load the ff-todo-management skill** and create a todo list for the planning process
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
8. **Load the ff-report-templates skill** for standardized output formatting
|
|
77
|
+
9. **Document your context** - Use `ff-agents-update` tool to create `.feature-factory/agents/planning-{UUID}.md`
|
|
78
78
|
|
|
79
79
|
## File Management Tools
|
|
80
80
|
|
|
@@ -177,6 +177,20 @@ Before planning:
|
|
|
177
177
|
5. Avoid conflicting with existing plans
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
+
## Swarm Mode (Parallel Self-Delegation)
|
|
181
|
+
|
|
182
|
+
When the user says **"plan in parallel"**, **"delegate"**, **"swarm"**, **"split this up"**, or **"parallelize"**:
|
|
183
|
+
|
|
184
|
+
1. **Load the ff-swarm skill** immediately
|
|
185
|
+
2. **Become a coordinator** — stop doing planning work yourself
|
|
186
|
+
3. **Partition** the task into independent, non-overlapping planning units
|
|
187
|
+
4. **Spawn sub-agents of yourself** (`planning`) for each partition via the Task tool
|
|
188
|
+
5. **Monitor, aggregate, and report** the unified plan
|
|
189
|
+
|
|
190
|
+
This is different from normal delegation (ff-delegation), which sends work to _different_ agent types. Swarm mode creates copies of _yourself_ to parallelize the same type of work.
|
|
191
|
+
|
|
192
|
+
See the `ff-swarm` skill for full process details, partitioning rules, and guardrails.
|
|
193
|
+
|
|
180
194
|
## Delegation Strategy
|
|
181
195
|
|
|
182
196
|
ALWAYS prefer delegation. Parallelize these tasks:
|
|
@@ -360,6 +374,7 @@ Recommend escalation to full architectural planning when:
|
|
|
360
374
|
## Knowledge Management
|
|
361
375
|
|
|
362
376
|
**Always be learning:**
|
|
377
|
+
|
|
363
378
|
- Use `docs/learnings/` to store findings, decisions, and patterns.
|
|
364
379
|
- Search `docs/learnings/` before debugging complex issues.
|
|
365
380
|
- Load the `ff-learning` skill for details on how to write good learning docs.
|
package/agents/reviewing.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Comprehensive validation agent that reviews implementation quality and feeds results back to the building agent. Use this to validate code changes across all dimensions. Can delegate to read-only sub-agents for parallel validation.
|
|
3
|
-
mode: primary
|
|
4
3
|
color: '#f59e0b'
|
|
5
4
|
tools:
|
|
6
5
|
read: true
|
|
@@ -14,6 +13,7 @@ permission:
|
|
|
14
13
|
'*': allow
|
|
15
14
|
task:
|
|
16
15
|
'ff-*': allow
|
|
16
|
+
reviewing: allow
|
|
17
17
|
explore: allow
|
|
18
18
|
general: deny
|
|
19
19
|
# File tools - agents directory (read/write for own context)
|
|
@@ -71,9 +71,9 @@ At the start of EVERY review task:
|
|
|
71
71
|
3. **Read relevant contexts** - Use `ff-agents-show()` to read contexts from @building, @ff-security, etc.
|
|
72
72
|
4. **Generate your UUID** - Create unique ID: `xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`
|
|
73
73
|
5. **Load the ff-todo-management skill** and create a todo list for tracking review progress
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
6. **Load the ff-report-templates skill** for standardized output formatting
|
|
75
|
+
7. **Load the ff-severity-classification skill** to classify findings consistently
|
|
76
|
+
8. **Document your context** - Use `ff-agents-update` tool to create `.feature-factory/agents/reviewing-{UUID}.md`
|
|
77
77
|
|
|
78
78
|
## File Management Tools
|
|
79
79
|
|
|
@@ -174,6 +174,20 @@ Before reviewing:
|
|
|
174
174
|
5. Incorporate security findings into your final report
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
+
## Swarm Mode (Parallel Self-Delegation)
|
|
178
|
+
|
|
179
|
+
When the user says **"review in parallel"**, **"delegate"**, **"swarm"**, **"split this up"**, or **"parallelize"**:
|
|
180
|
+
|
|
181
|
+
1. **Load the ff-swarm skill** immediately
|
|
182
|
+
2. **Become a coordinator** — stop doing review work yourself
|
|
183
|
+
3. **Partition** the files or validation dimensions into independent, non-overlapping units
|
|
184
|
+
4. **Spawn sub-agents of yourself** (`reviewing`) for each partition via the Task tool
|
|
185
|
+
5. **Monitor, aggregate, and report** the unified validation report
|
|
186
|
+
|
|
187
|
+
This is different from normal delegation (ff-delegation), which sends work to _different_ agent types. Swarm mode creates copies of _yourself_ to parallelize the same type of work.
|
|
188
|
+
|
|
189
|
+
See the `ff-swarm` skill for full process details, partitioning rules, and guardrails.
|
|
190
|
+
|
|
177
191
|
## Validation Approach
|
|
178
192
|
|
|
179
193
|
As a read-only reviewing agent, you perform all validation directly without delegating to sub-agents. Execute comprehensive validation across all dimensions:
|
|
@@ -484,6 +498,7 @@ This creates a tight feedback loop for high-quality output.
|
|
|
484
498
|
## Knowledge Management
|
|
485
499
|
|
|
486
500
|
**Always be learning:**
|
|
501
|
+
|
|
487
502
|
- Use `docs/learnings/` to store findings, decisions, and patterns.
|
|
488
503
|
- Search `docs/learnings/` before debugging complex issues.
|
|
489
504
|
- Load the `ff-learning` skill for details on how to write good learning docs.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@syntesseraai/opencode-feature-factory",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "OpenCode plugin for Feature Factory agents - provides sub-agents and skills for validation, review, security, and architecture assessment",
|
|
7
7
|
"license": "MIT",
|
|
@@ -1,25 +1,36 @@
|
|
|
1
1
|
# Feature Factory Learning Protocol
|
|
2
2
|
|
|
3
|
-
This skill enables agents to continuously document and retrieve knowledge across the lifecycle of a task
|
|
3
|
+
This skill enables agents to continuously document, organize, and retrieve knowledge across the lifecycle of a task using a strict hierarchical index structure. It ensures that knowledge is discoverable, context-rich, and properly categorized to aid LLM reasoning.
|
|
4
4
|
|
|
5
|
-
## Core Philosophy
|
|
5
|
+
## Core Philosophy & Hierarchy
|
|
6
6
|
|
|
7
|
-
1. **
|
|
8
|
-
2. **
|
|
9
|
-
3. **
|
|
7
|
+
1. **High Priority Context (`AGENTS.md`)**: Contains mandatory, "must-have" information that applies to every session. This is the root of all agent behavioral rules.
|
|
8
|
+
2. **Discoverable Knowledge (`docs/INDEX.md`)**: The root index for all discoverable project information. Agents MUST consult this index when assessing user input or starting a new task.
|
|
9
|
+
3. **Hierarchical Indexing**:
|
|
10
|
+
- `docs/INDEX.md` points to subfolder `INDEX.md` files (e.g., `docs/architecture/INDEX.md`, `docs/learnings/INDEX.md`).
|
|
11
|
+
- Every link in an `INDEX.md` file MUST include a **verbose, detailed description** of the target file or subfolder's purpose. This description is specifically designed to aid LLM reasoning when an agent is deciding which path to follow.
|
|
12
|
+
- Each subfolder's `INDEX.md` references the files at its own level and any nested subfolder `INDEX.md` files, alongside their descriptive purposes.
|
|
13
|
+
4. **Continuous Documentation**: Write down important facts, solutions, architectural decisions, and progress as soon as verified. Always link new documents in the relevant `INDEX.md`.
|
|
10
14
|
|
|
11
15
|
## How to Use This Skill
|
|
12
16
|
|
|
13
|
-
### 1.
|
|
17
|
+
### 1. Retrieving Knowledge (Reading & Discovery)
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
Before diving into implementation, debugging, or when assessing user input:
|
|
16
20
|
|
|
17
|
-
**
|
|
21
|
+
- **Start at `docs/INDEX.md`**: Read the root index to understand the available knowledge domains.
|
|
22
|
+
- **Navigate the Tree**: Follow the descriptive links to subfolder `INDEX.md` files to find specific guidelines, architecture rules, or past learnings.
|
|
23
|
+
- **Use the right tools**: Use the `read` tool to traverse the `INDEX.md` files.
|
|
18
24
|
|
|
19
|
-
|
|
20
|
-
Use descriptive, kebab-case filenames: `docs/learnings/auth-token-refresh-flow.md`, `docs/learnings/docker-build-caching.md`.
|
|
25
|
+
### 2. Documenting New Knowledge (Writing)
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
Whenever you discover a non-obvious solution, establish a new convention, resolve a complex bug, or need to document progress:
|
|
28
|
+
|
|
29
|
+
1. **Create the Document**: Use the `write` tool to create a detailed markdown file in the appropriate subfolder (e.g., `docs/learnings/auth-token-refresh-flow.md`).
|
|
30
|
+
2. **Update the Index**: You MUST update the `INDEX.md` file in that same folder. Add a link to your new file along with a verbose description of what the file contains and when another agent should read it.
|
|
31
|
+
3. **Create Missing Indexes**: If a folder does not have an `INDEX.md` file, you MUST create it and link it back to the parent `INDEX.md` with a detailed reasoning description.
|
|
32
|
+
|
|
33
|
+
**Template for new learning documents:**
|
|
23
34
|
|
|
24
35
|
```markdown
|
|
25
36
|
# [Topic Title]
|
|
@@ -37,32 +48,18 @@ Use descriptive, kebab-case filenames: `docs/learnings/auth-token-refresh-flow.m
|
|
|
37
48
|
|
|
38
49
|
## Why this matters
|
|
39
50
|
|
|
40
|
-
[Explain why this approach was chosen or why the bug occurred.]
|
|
51
|
+
[Explain why this approach was chosen or why the bug occurred. Provide enough context to guide future agents.]
|
|
41
52
|
```
|
|
42
53
|
|
|
43
|
-
###
|
|
44
|
-
|
|
45
|
-
Before diving into debugging or implementing features, scan the `docs/` and `docs/learnings/` directories for relevant context.
|
|
46
|
-
|
|
47
|
-
**Tools to use:**
|
|
48
|
-
|
|
49
|
-
- `glob` tool with pattern `docs/learnings/*.md` to see all stored learnings.
|
|
50
|
-
- `grep` tool to search inside `docs/` and `docs/learnings/` for specific keywords (e.g., error messages, library names).
|
|
51
|
-
- `read` tool to pull the full context of relevant markdown files.
|
|
52
|
-
|
|
53
|
-
### 3. Updating Existing Knowledge (Refining)
|
|
54
|
-
|
|
55
|
-
If you find an existing learning document that is outdated or incomplete based on new work, use the `edit` tool to update it. Knowledge should evolve with the codebase.
|
|
56
|
-
|
|
57
|
-
## When to Document a Learning
|
|
54
|
+
### 3. Maintaining the Index Tree
|
|
58
55
|
|
|
59
|
-
- **
|
|
60
|
-
|
|
61
|
-
- **
|
|
62
|
-
- **Undocumented Behaviors:** Workarounds for third-party API quirks or internal system edge cases.
|
|
56
|
+
- **Verbose Descriptions**: When adding an entry to an `INDEX.md`, do not just list the filename. Explain _why_ the file exists, _what_ specific problems it solves, and _when_ an agent should consult it.
|
|
57
|
+
_Example:_ `* [auth-flow.md](./auth-flow.md) - Details the OAuth2 token refresh cycle, including how to handle race conditions when multiple requests hit an expired token. Consult this when modifying any API client or authentication middleware.`
|
|
58
|
+
- **Refinement**: If an existing learning document or its index description is outdated, use the `edit` tool to update it.
|
|
63
59
|
|
|
64
60
|
## Checklist for Agents
|
|
65
61
|
|
|
66
|
-
- [ ]
|
|
67
|
-
- [ ]
|
|
68
|
-
- [ ]
|
|
62
|
+
- [ ] Am I assessing user input or starting a task? -> **Read `docs/INDEX.md` to discover context.**
|
|
63
|
+
- [ ] Have I encountered a novel problem, architectural decision, or established a new pattern? -> **Document it in a new file.**
|
|
64
|
+
- [ ] Did I create a new document in `docs/`? -> **Update the local `INDEX.md` with a verbose description.**
|
|
65
|
+
- [ ] Is a folder missing an `INDEX.md`? -> **Create it and link it to the parent `INDEX.md`.**
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ff-swarm
|
|
3
|
+
description: Enables agents to partition tasks and spawn sub-agents of themselves for parallel execution. The originating agent becomes the coordinator, monitoring progress and aggregating results.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: opencode
|
|
6
|
+
metadata:
|
|
7
|
+
audience: agents
|
|
8
|
+
category: orchestration
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Swarm: Self-Partitioned Parallel Execution
|
|
12
|
+
|
|
13
|
+
This skill enables any agent to split a task into partitions and spawn copies of itself as sub-agents to work in parallel. The original agent becomes the **coordinator** — it does not do implementation work itself, only orchestrates.
|
|
14
|
+
|
|
15
|
+
## When to Activate
|
|
16
|
+
|
|
17
|
+
Activate this skill when the user explicitly requests parallel execution:
|
|
18
|
+
|
|
19
|
+
- **"build in parallel"**
|
|
20
|
+
- **"delegate"** (when referring to splitting the current task, not delegating to a different agent type)
|
|
21
|
+
- **"swarm this"**
|
|
22
|
+
- **"split this up"**
|
|
23
|
+
- **"parallelize"**
|
|
24
|
+
|
|
25
|
+
**Do NOT activate** for normal delegation to different agent types (e.g., delegating review to @reviewing). Use the `ff-delegation` skill for that instead.
|
|
26
|
+
|
|
27
|
+
## How It Differs from ff-delegation
|
|
28
|
+
|
|
29
|
+
| Aspect | ff-delegation | ff-swarm |
|
|
30
|
+
| -------------- | ------------------------------------ | -------------------------------------- |
|
|
31
|
+
| Sub-agent type | Different specialized agents | Copies of yourself (same agent type) |
|
|
32
|
+
| Purpose | Cross-functional work (review, test) | Partitioned parallel work on same task |
|
|
33
|
+
| Coordinator | You continue your own work too | You STOP working, only coordinate |
|
|
34
|
+
| Use case | "Review this" / "Run security audit" | "Build these 3 features in parallel" |
|
|
35
|
+
|
|
36
|
+
## Coordinator Role
|
|
37
|
+
|
|
38
|
+
Once you activate swarm mode, you become a **pure coordinator**. Your responsibilities change:
|
|
39
|
+
|
|
40
|
+
1. **Partition** — Break the task into independent, non-overlapping units of work
|
|
41
|
+
2. **Spawn** — Create sub-agents of your own type for each partition
|
|
42
|
+
3. **Monitor** — Track progress of all sub-agents
|
|
43
|
+
4. **Aggregate** — Collect and combine results when sub-agents complete
|
|
44
|
+
5. **Report** — Present the unified result to the user
|
|
45
|
+
|
|
46
|
+
**You do NOT do implementation work yourself.** If there are N partitions, spawn N sub-agents.
|
|
47
|
+
|
|
48
|
+
## Partitioning Rules
|
|
49
|
+
|
|
50
|
+
Good partitions are:
|
|
51
|
+
|
|
52
|
+
- **Independent** — No partition depends on another's output
|
|
53
|
+
- **Non-overlapping** — No two partitions modify the same files
|
|
54
|
+
- **Roughly equal** — Balance work across partitions
|
|
55
|
+
- **Self-contained** — Each partition has all the context it needs
|
|
56
|
+
|
|
57
|
+
If the task cannot be cleanly partitioned (e.g., sequential dependencies, shared file modifications), tell the user and either:
|
|
58
|
+
|
|
59
|
+
- Execute sequentially yourself (no swarm)
|
|
60
|
+
- Partition only the independent parts and handle dependent parts yourself after sub-agents complete
|
|
61
|
+
|
|
62
|
+
## Process
|
|
63
|
+
|
|
64
|
+
### Step 1: Analyze and Partition
|
|
65
|
+
|
|
66
|
+
```markdown
|
|
67
|
+
I'll split this into N parallel tasks:
|
|
68
|
+
|
|
69
|
+
1. **[Partition A]** — [scope and files]
|
|
70
|
+
2. **[Partition B]** — [scope and files]
|
|
71
|
+
3. **[Partition C]** — [scope and files]
|
|
72
|
+
|
|
73
|
+
These are independent — no shared files or dependencies between them.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Verify no file conflicts exist between partitions. If two partitions need the same file, restructure the partitions.
|
|
77
|
+
|
|
78
|
+
### Step 2: Generate UUIDs
|
|
79
|
+
|
|
80
|
+
Generate a coordinator UUID for yourself and a child UUID for each sub-agent:
|
|
81
|
+
|
|
82
|
+
- Coordinator: `{your-agent-type}-{coordinator-uuid}` (your context file)
|
|
83
|
+
- Sub-agent 1: `{your-agent-type}-{child-uuid-1}`
|
|
84
|
+
- Sub-agent 2: `{your-agent-type}-{child-uuid-2}`
|
|
85
|
+
- Sub-agent N: `{your-agent-type}-{child-uuid-N}`
|
|
86
|
+
|
|
87
|
+
### Step 3: Document Coordinator Context
|
|
88
|
+
|
|
89
|
+
Write your context file with the partition plan and child UUIDs:
|
|
90
|
+
|
|
91
|
+
```markdown
|
|
92
|
+
# Coordinator: {agent-type}
|
|
93
|
+
|
|
94
|
+
**Mode:** Swarm coordinator
|
|
95
|
+
**Task:** [overall task description]
|
|
96
|
+
**Partitions:** N
|
|
97
|
+
**Sub-agents:** [child-uuid-1, child-uuid-2, ...]
|
|
98
|
+
|
|
99
|
+
## Partition Plan
|
|
100
|
+
|
|
101
|
+
1. [Partition A] → child-uuid-1
|
|
102
|
+
2. [Partition B] → child-uuid-2
|
|
103
|
+
3. [Partition C] → child-uuid-3
|
|
104
|
+
|
|
105
|
+
## Status
|
|
106
|
+
|
|
107
|
+
- [ ] child-uuid-1: Pending
|
|
108
|
+
- [ ] child-uuid-2: Pending
|
|
109
|
+
- [ ] child-uuid-3: Pending
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Step 4: Spawn Sub-Agents
|
|
113
|
+
|
|
114
|
+
Use the Task tool to spawn each sub-agent **of your own type**. Each sub-agent must receive:
|
|
115
|
+
|
|
116
|
+
1. **Full context** of its specific partition (not the whole task)
|
|
117
|
+
2. **File boundaries** — which files it owns and must not go beyond
|
|
118
|
+
3. **Completion criteria** — what "done" looks like for its partition
|
|
119
|
+
4. **Context tracking instructions** — write results to its agent context file
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
Task({your-agent-type}): "
|
|
123
|
+
You are a swarm sub-agent handling partition N of a parallel task.
|
|
124
|
+
|
|
125
|
+
## Your Partition
|
|
126
|
+
[Detailed description of this partition's scope]
|
|
127
|
+
|
|
128
|
+
## Files You Own
|
|
129
|
+
- file1.ts
|
|
130
|
+
- file2.ts
|
|
131
|
+
|
|
132
|
+
## Files You Must NOT Touch
|
|
133
|
+
- [files owned by other partitions]
|
|
134
|
+
|
|
135
|
+
## Completion Criteria
|
|
136
|
+
- [What done looks like]
|
|
137
|
+
|
|
138
|
+
## Context
|
|
139
|
+
Write your progress and results to .feature-factory/agents/{your-agent-type}-{child-uuid}.md
|
|
140
|
+
"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Spawn all sub-agents in a single message** so they run concurrently.
|
|
144
|
+
|
|
145
|
+
### Step 5: Monitor Progress
|
|
146
|
+
|
|
147
|
+
After spawning, periodically check on sub-agents:
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
ff-agents-current() → See which sub-agents are still active
|
|
151
|
+
ff-agents-show(id: "child-uuid") → Read completed results
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Step 6: Aggregate Results
|
|
155
|
+
|
|
156
|
+
Once all sub-agents complete:
|
|
157
|
+
|
|
158
|
+
1. Read each sub-agent's context file for results
|
|
159
|
+
2. Check for any conflicts or issues
|
|
160
|
+
3. Combine results into a unified summary
|
|
161
|
+
4. Run any cross-partition validation (e.g., type checking, tests)
|
|
162
|
+
|
|
163
|
+
### Step 7: Clean Up and Report
|
|
164
|
+
|
|
165
|
+
1. Clean up all sub-agent context files
|
|
166
|
+
2. Clean up your own coordinator context file
|
|
167
|
+
3. Present the unified result to the user
|
|
168
|
+
|
|
169
|
+
## Example: Building Agent Swarm
|
|
170
|
+
|
|
171
|
+
User says: "Build the user auth, payment integration, and notification system in parallel"
|
|
172
|
+
|
|
173
|
+
```markdown
|
|
174
|
+
## Partition Plan
|
|
175
|
+
|
|
176
|
+
1. **User Auth** → building-aaa111
|
|
177
|
+
- Files: src/auth/\*.ts, src/middleware/auth.ts
|
|
178
|
+
- Scope: Login, registration, JWT handling
|
|
179
|
+
|
|
180
|
+
2. **Payment Integration** → building-bbb222
|
|
181
|
+
- Files: src/payments/\*.ts, src/api/billing.ts
|
|
182
|
+
- Scope: Stripe integration, subscription management
|
|
183
|
+
|
|
184
|
+
3. **Notification System** → building-ccc333
|
|
185
|
+
- Files: src/notifications/\*.ts, src/api/notify.ts
|
|
186
|
+
- Scope: Email, push, webhook notifications
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Then spawn 3 `building` sub-agents, one for each partition.
|
|
190
|
+
|
|
191
|
+
## Example: Planning Agent Swarm
|
|
192
|
+
|
|
193
|
+
User says: "Plan out the API redesign, database migration, and frontend overhaul in parallel"
|
|
194
|
+
|
|
195
|
+
Spawn 3 `planning` sub-agents, each creating their own plan for their partition.
|
|
196
|
+
|
|
197
|
+
## Example: Reviewing Agent Swarm
|
|
198
|
+
|
|
199
|
+
User says: "Review these 12 changed files in parallel"
|
|
200
|
+
|
|
201
|
+
Partition files into groups and spawn `reviewing` sub-agents, each reviewing their subset.
|
|
202
|
+
|
|
203
|
+
## Guardrails
|
|
204
|
+
|
|
205
|
+
- **Maximum sub-agents:** Cap at 5 concurrent sub-agents to avoid overwhelming the system
|
|
206
|
+
- **File ownership is strict:** Sub-agents must not modify files outside their partition
|
|
207
|
+
- **Fail fast:** If a sub-agent fails, report it immediately rather than waiting for all to complete
|
|
208
|
+
- **No nested swarms:** Sub-agents must NOT activate ff-swarm themselves (one level of fan-out only)
|
|
209
|
+
- **Sequential fallback:** If partitioning isn't possible, say so and execute normally
|