You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(prompt): add concurrency discipline guidance for sub-agent spawning (#86)
LLM agents could spawn excessive parallel sub-agents on complex tasks,
wasting resources and tokens. Rather than hard-coding limits in the
runtime, guide the LLM via system prompt to self-regulate concurrency
based on task complexity — start small, assess before parallelizing,
iterate instead of pre-allocating, and match parallelism to actual
task breadth.
Copy file name to clipboardExpand all lines: crates/loopal-prompt-system/prompts/tools/agent-guidelines.md
+14-3Lines changed: 14 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,16 +10,28 @@ You can spawn sub-agents to handle tasks autonomously. Each agent runs in its ow
10
10
11
11
## When to Spawn
12
12
13
-
-**Parallel independent tasks**: Multiple searches, analyses, or implementations that don't depend on each other — launch multiple agents in one message
13
+
-**Parallel independent tasks**: Multiple searches, analyses, or implementations that don't depend on each other
14
14
-**Deep codebase exploration**: Use an `explore` agent (read-only, optimized for search) to investigate large or unfamiliar areas
15
15
-**Architecture planning**: Use a `plan` agent (read-only) to design implementation approaches
16
16
-**Protecting context**: Offload research-heavy work to keep your main context focused
17
17
18
18
## When NOT to Spawn
19
19
20
20
- Trivial tasks you can do in one or two tool calls
21
-
- Tasks that need your accumulated conversation context (sub-agents start fresh or with a directive)
21
+
- Tasks that need your accumulated conversation context (sub-agents start fresh)
22
22
- Sequential single-file changes where continuity matters
23
+
- When you already have enough information to proceed directly
24
+
25
+
## Concurrency Discipline
26
+
27
+
**Prefer fewer, focused agents over many parallel ones.** Each agent consumes an OS process, LLM context, and tokens. Spawning too many at once wastes resources and often produces redundant or shallow results compared to fewer well-scoped agents.
28
+
29
+
Scale concurrency to task complexity:
30
+
-**Start small.** Default to the minimum number of agents that covers the task. A single well-prompted agent often outperforms several vague ones.
31
+
-**Assess before parallelizing.** Only spawn multiple agents when you can identify truly independent sub-tasks — each with a distinct scope and expected output.
32
+
-**Iterate, don't pre-allocate.** Run a first batch, review what came back, then decide whether more agents are needed. Avoid spawning "just in case."
33
+
-**Avoid redundant exploration.** Don't split one search across many explore agents — give one agent a comprehensive, well-scoped prompt instead. Reserve multiple explore agents for genuinely separate areas of the codebase.
34
+
-**Consider the cost.** A complex multi-area refactoring may justify several parallel agents; a focused bug investigation rarely does. Match the parallelism to the real breadth of the work.
23
35
24
36
## Agent Types
25
37
@@ -32,5 +44,4 @@ You can spawn sub-agents to handle tasks autonomously. Each agent runs in its ow
32
44
- Sub-agent results are NOT shown to the user — you must summarize what was found or accomplished.
33
45
- Always include a short description (3-5 words) when spawning.
34
46
- For open-ended research, use `explore` type. For implementation, use default.
35
-
- Launch multiple independent agents simultaneously for maximum efficiency.
36
47
- Trust agent outputs generally, but verify critical findings before acting on them.
0 commit comments