MCPcopy Create free account
hub / github.com/CloudAI-X/opencode-workflow / ParallelGuardPlugin

Function ParallelGuardPlugin

plugins/parallel-guard.ts:8–29  ·  view source on GitHub ↗
({})

Source from the content-addressed store, hash-verified

6let recentTaskCalls: number[] = []
7
8export const ParallelGuardPlugin = async ({}) => {
9 return {
10 "tool.execute.before": async (input, output) => {
11 if (input.tool !== "task" && input.tool !== "Task") {
12 return
13 }
14
15 const now = Date.now()
16
17 // Track task calls within 5 second window
18 recentTaskCalls = recentTaskCalls.filter((t) => now - t < 5000)
19 recentTaskCalls.push(now)
20
21 // If we see sequential task calls (not batched), log educational message
22 if (recentTaskCalls.length === 2) {
23 console.log(
24 "[parallel-guard] Tip: Launch multiple Task calls in ONE message for parallel execution!"
25 )
26 }
27 },
28 }
29}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected