golemcloud/golem/golem-parallel-workers-moonbit
Claude Code and agent skill by golemcloud/golem
- community
Checking that the SKILL.md file is still in the repository.
Fan out work to multiple parallel agents and collect results in a MoonBit Golem project. Use when the user asks about parallel execution, fan-out/fan-in, spawning child agents for parallel work, forking, or aggregating results from multiple agents.
Install
npx vskill@latest install golemcloud/golem/golem-parallel-workers-moonbitSKILL.md
The same SKILL.md was published earlier as golemcloud/golem/golem-parallel-workers-moonbit.
Parallel Workers — Fan-Out / Fan-In (MoonBit)
Overview
Golem agents process invocations sequentially. Async work within one invocation can overlap cooperatively, but this does not provide CPU-thread parallelism. Distribute independent CPU work across multiple agent instances. This skill covers two approaches:
- Child agents via `AgentClient::scoped_upsert` — spawn separate agent instances, dispatch work, and collect results
- `@api.fork()` — clone the current agent at the current execution point for lightweight parallel execution
Approach 1: Child Agent Fan-Out
Spawn child agents, dispatch work via fire-and-forget triggers, and collect results via Golem promises.
Import "moonbitlang/core/encoding/utf8" @utf8 in moon.pkg. Raw @types.PromiseId has no IntoWire implementation. Transport its primitive fields (agent ID, fingerprint and oplog index) across RPC, then reconstruct the host record in the worker. The fingerprint identifies the agent incarnation that created the promise, so carry it unchanged.
Basic Pattern with Promises
Chunked Fan-Out
Batch children to limit concurrency:
Approach 2: @api.fork()
@api.fork() clones the current agent at the current execution point, creating a new agent instance with the same state, a new agent ID and no key. Only a durable agent can fork, and the forked agent is durable too. Use Golem promises to synchronize between the original and forked agents.
Basic Fork Pattern
Multi-Fork Fan-Out
Fork multiple times for N-way parallelism:
When to Use Which Approach
| Criteria | Child Agents | @api.fork() | |
|---|---|---|---|
| Work is independent and stateless | ✅ Best fit | Works but overkill | |
| Need to share current state with workers | ❌ Must pass via args | ✅ Forked copy inherits state | |
| Workers need persistent identity | ✅ Each has own ID | ❌ Each forked agent gets a new agent ID and no key | |
| Number of parallel tasks is dynamic | ✅ Spawn as many as needed | ✅ Fork in a loop | |
| Need simple error isolation | ✅ Child failure doesn't crash parent | ⚠️ Forked agent shares oplog lineage |
Key Points
- No threads: Golem is single-threaded per agent — parallelism is achieved by distributing across agent instances
- Durability: All RPC calls, promises, and fork operations are durably recorded — work survives crashes
- Deadlock avoidance: Never have two agents awaiting each other synchronously — use
trigger_to break cycles - Cleanup: Child agents persist after the coordinator finishes; delete them explicitly if they hold unwanted state
- Scoped clients: Always prefer
AgentClient::scoped_upsertover manualupsert/dropfor client lifecycle management - Aggregation: Collect results by iterating over promise IDs and calling
@api.await_promisefor each
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinggolem-skills/skills/moonbit/golem-parallel-workers-moonbit/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/golemcloud/golem/golem-parallel-workers-moonbit)