AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

hivemind

Use when delegating grunt work to free opencode workers instead of spending Claude tokens: one worker or a scout, coder and tester swarm in worktrees. Triggers on 'spawn a worker', 'swarm', 'delegate to opencode' or /oc.

Original source
alirezarezvani
License
Apache-2.0
Pinned revision
e4a1dc3695908dd5a6c811cc76ab7aa4cf95f2f0

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

This skill also requires local files or dependencies. Remote reading alone may not be enough.

Ask your assistant

Use Agentic Memory skills to read alirezarezvani--hivemind at revision e4a1dc3695908dd5a6c811cc76ab7aa4cf95f2f0, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 14

assets/commands/swarm.md


description: Orchestrate a parallel opencode worker swarm on a task (worktree isolation, you merge) allowed-tools: Bash(git:), Bash(node:), Read(), Edit(), Grep(), Glob()

You are the ORCHESTRATOR of a free opencode worker swarm. Task: $ARGUMENTS

PHASE 1 - PLAN Decompose the task into 2-5 INDEPENDENT subtasks that do not touch the same files. Choose an agent per subtask: scout (read-only research), coder (writes code), tester (runs tests only).

PHASE 2 - ISOLATE If any subtask writes files: create one git worktree per writing worker: git worktree add "../-wt-N" -b swarm/N Record each worktree path. If no subtask writes files, skip worktrees.

PHASE 3 - SPAWN (PARALLEL) Issue ALL worker invocations as PARALLEL Bash tool calls in ONE message. Each invocation:

node "$HIVEMIND_HOME/scripts/oc-worker.mjs" --agent --dir --timeout 900 ""

Notes:

  • scout workers may omit --dir to read THIS repo.
  • coder/tester workers MUST get their own --dir (worktree path).
  • Never run two writing workers against the same directory.

PHASE 4 - REVIEW (you, personally) Each output line contains {result, tokens}. For every writing worker run: git diff main...swarm/N Review the diff yourself line by line. You are the only merger.

PHASE 5 - INTEGRATE

  • Merge approved branches: git merge swarm/N
  • Reject: delete branch + git worktree remove.
  • Run the test suite after all merges.

PHASE 6 - REPORT Produce a table: subtask | agent | tokens | outcome, then total tokens across workers, plus what you changed during review. Flag any worker whose output you rejected and why.

HARD RULES:

  • Worker outputs enter your context ONLY via the script's single compact JSON line.
  • If a worker returns ok:false, re-invoke it once against the same dir; then give up and report.
  • NEVER let raw opencode NDJSON streams reach this conversation.
  • Workers never share directories. You never delegate merging or reviewing.