Skip to main content

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.

v1.0.2New

Unsigned, install at your own risk

Unverified

This skill has no cryptographic signature attached. We can't verify the contents match what the publisher intended.

Install this skill

No account required. Pick your tool, or use the command that detects it for you.

Run in your terminal. It detects your AI tool.

npx @skills-hub-ai/cli install alirezarezvani-hivemind
Or get the file:
Browse all CLI commands →
Manual setup by platform

Claude Code

~/.claude/skills/alirezarezvani-hivemind/SKILL.md

Setup guide →
0Save

Instructions

Hivemind: Claude Code as Orchestrator, opencode as Free Worker Swarm

Claude Code = brain (plans, reviews, merges). opencode = disposable workers on free models
(opencode/mimo-v2.5-free default; verified $0.00 per run).

Prerequisites (external dependency)

This skill is a thin orchestration layer over opencode, a
third-party CLI. It is not bundled — install and authenticate it yourself first:

RequirementNotes
Node.js >= 18The scripts use fetch and node:timers/promises.
opencode CLI on PATHnpm i -g opencode-ai (or the installer opencode documents).
An authenticated opencode accountopencode auth login. Workers run as your account.
Default model opencode/mimo-v2.5-freeA free tier offered by opencode, not by Anthropic. Availability, rate limits, and pricing are opencode's to change — override with --model at any time.
Windows only: OPENCODE_GIT_BASH_PATHPoint at C:\Program Files\Git\bin\bash.exe, set persistently.

Data flow (read before installing)

Hivemind is opt-in and ships outside every domain bundle. By default your code
leaves your machine:
the default model, opencode/mimo-v2.5-free, runs on
opencode's hosted service, so each worker sends its prompt, plus any files or diffs
you give it, to opencode's endpoints. Nothing on the worker side calls the Anthropic
API.

To keep code local, point --model at a model served on your own machine (for
example an Ollama or LM Studio provider configured in your opencode config). With a
hosted model, delegate only code you are allowed to send to that provider, and never
delegate secrets.

Setup

  1. Put this skill folder wherever your agent loads skills from (e.g. ~/.claude/skills/hivemind).
  2. Export HIVEMIND_HOME pointing at that folder — the bundled slash commands use it:
    export HIVEMIND_HOME="$HOME/.claude/skills/hivemind"
    
  3. Copy the bundled assets into place:
    • assets/commands/*.md -> ~/.claude/commands/ (the /hive, /oc, /swarm, ... entry points)
    • assets/agents/*.md -> ~/.config/opencode/agent/ (the scout / coder / tester worker personas)

Both copies are optional: everything the commands do can be driven by invoking
scripts/oc-worker.mjs directly, and any opencode agent name works with --agent.

Runtime state (.runs/*.jsonl) is written inside this folder and is gitignored.

Components

Path (relative to this skill dir)Purpose
scripts/oc-worker.mjsONLY sanctioned way to invoke a worker. Hardened join point.
scripts/oc-status.mjsFleet progress from run logs (oc-status.mjs <run-id>)
scripts/oc-aggregate.mjsDedupe/synthesize N worker outputs; consensus findings first
scripts/bench/run-bench.mjsBenchmark configs A (claude solo), B (opencode solo), C (orchestrated swarm)
scripts/bench/grader-prompt.mdBlind grading rubric (max 12 pts + PASS/FAIL gate)
scripts/oc-verify.mjsFan a worker's claims to a verifier on a DIFFERENT model; returns counts + needs_review
assets/commands/Slash-command entry points to copy into ~/.claude/commands/
assets/agents/scout / coder / tester / verifier agent definitions for opencode

Slash commands (ship in assets/commands/, copy to ~/.claude/commands/):

  • /hive <task> - AUTO-ROUTER. Classifies task -> single worker, generic swarm, or template. Default entry point; prefer this over manual routing.
  • /oc <task> - single worker delegation
  • /swarm <task> - generic parallel swarm
  • /review-panel <diff> - 4-lens parallel review (correctness/security/performance/style) + consensus aggregation
  • /research-sweep <question> - 3-5 parallel research angles, synthesized
  • /migration <task> - batched per-worktree migration workers + sequenced merge
  • /test-fleet <target> - partitioned parallel test runs with safety checks

Worker agents (ship in assets/agents/, copy to ~/.config/opencode/agent/):

  • scout - read-only research (no write/edit/bash)
  • coder - implements one subtask in its worktree
  • tester - runs tests only, never edits source

Invocation contract

node "<skill-dir>\scripts\oc-worker.mjs" [--agent scout|coder|tester] [--dir <path>] [--model <p/m>] [--timeout 900] [--run <id> --label <name>] [--json] "TASK TEXT"

Returns exactly ONE compact JSON line:
{ ok, result, tokens:{total,input,output,cache}, cost_usd, duration_ms, label, agent, model }

On failure: { ok:false, stage:"args"|"exec"|"api"|"parse"|"empty"|"schema", error } with stderr capped at 300 chars.

--json makes result a JSON value: the script extracts it from the reply, gives the model one
corrective retry, and fails with stage:"schema" if it still gets no parseable JSON.

--run <id> + --label <name> append lifecycle events (start/done/fail) to .runs/<id>.jsonl
inside this skill dir. Use them for EVERY swarm worker so progress is recoverable via
oc-status.mjs even after orchestrator context loss.

The script auto-manages the shared server: health-checks 127.0.0.1:4096, spawns opencode serve if dead, waits 5s, falls back to cold start. Workers are idempotent against their --dir; re-run once on ok:false before giving up.

HIVEMIND_SERVER_URL overrides that address (default http://127.0.0.1:4096). It must be a
valid URL with a numeric port; anything else fails fast with a single stage:"args" JSON line
rather than reaching the spawned process.

Verify instead of re-reading (do this before you trust a claim)

Re-checking every worker claim yourself costs more than the delegation saved. Send the
claims to a verifier instead:

node scripts/oc-verify.mjs --dir <same dir the worker saw> --claims findings.json --run <id>

Returns { confirmed, refuted, unsupported, unverified, needs_review[] }. Read
needs_review only — those are the refuted and unsupported claims. Confirmed claims are
counts, not prose, and do not come back into your context.

HARD RULES for this stage:

  • The verifier MUST run on a different model from the worker. Same model = same blind
    spots = a rubber stamp. The verifier defaults to opencode/nemotron-3.5-lightning-free
    against the worker's default opencode/mimo-v2.5-free; pass --model if you change either.
  • The verifier sees the FILES and the claims, never the worker's reasoning.
  • It defaults to REFUTED when uncertain, because a false CONFIRMED is acted on unchecked.
  • unverified > 0 means the verifier skipped claims. Treat those as unverified, not passed.
  • Still spot-check a sample yourself. Two free models agreeing is evidence, not proof.

Free models are not always up

Free opencode/* models return provider 404s and empty bodies often enough that an
unattended swarm cannot depend on any one of them. Never hardcode a free model id: they
stop being free without warning. Pass --model explicitly for scheduled or bulk work, and
when a free model fails twice, follow the fallback ladder below rather than retrying.

Golden Rule (non-negotiable)

Raw opencode NDJSON streams must NEVER enter your context. All output arrives via the
script's single JSON line. Never pipe opencode run --format json directly into this
conversation; never re-implement what the script does.

Single worker flow (/oc)

For one read-only question or small delegation: run oc-worker.mjs without worktrees.
Read-only tasks may omit --agent/--dir. Summarize result for the user.
If files were written: show git diff before letting the user commit.

Swarm flow (multi-worker)

  1. Decompose task into 2-5 INDEPENDENT subtasks (no shared files).
  2. Writing workers get isolated worktrees FIRST: git worktree add ../<repo>-wt-N -b swarm/N.
  3. Issue ALL worker invocations as PARALLEL Bash tool calls in ONE message.
  4. Review every diff yourself (git diff main...swarm/N). YOU are the only merger.
  5. Merge approved branches, remove worktrees, run tests.
  6. Report table: subtask | agent | tokens | outcome + total worker tokens.

HARD RULES: workers never share directories; never delegate merging/reviewing;
escalate to your own Sonnet only when a free-model worker demonstrably fails twice.

Benchmarking

node scripts\bench\run-bench.mjs --repo <project> [--configs a,b,c] [--task 1-5]

Appends JSONL records (ts, config, tokens, cost, duration) to bench-results.jsonl.
Grade artifacts blind with grader-prompt.md (grader sees only task spec + output).
Configs: A=claude solo baseline, B=opencode solo, C=claude orchestrating 2 workers.

Fallback ladder (all flows)

  1. Worker ok:false -> re-invoke once against the same dir.
  2. Still failing -> orchestrator performs that subtask inline, marks it [orchestrator-sourced].
  3. opencode entirely down (exec/api twice) -> announce, abandon workers, do the task directly.
    Never let a swarm fail a task that Claude could have done itself.

Fleet patterns

Four reusable topologies ship as slash commands (see table above). Shared invariants:
parallel spawns in one message; --run/--label on every worker; aggregation via
oc-aggregate.mjs when 3+ workers produce findings; consensus beats single-lens claims;
worktree isolation whenever any worker writes.

Windows notes (hard-won)

  • Requires OPENCODE_GIT_BASH_PATH=C:\Program Files\Git\bin\bash.exe (set persistently).
  • The script resolves the REAL opencode.exe by parsing the npm .cmd shim — Node's
    EINVAL policy blocks spawning .cmd directly. Do not "simplify" resolver back to
    where.exe first-line.
  • Free models: opencode/mimo-v2.5-free, opencode/nemotron-3.5-lightning-free,
    opencode/hy3-free. NOTE: opencode-go/* models require workspace billing — avoid.

Known limits

  • Free-tier rate limits can 429 under heavy swarms; space out retries.
  • Worker quality varies; always review diffs. Scout answers are evidence-cited.
  • Bench config C consumes real Claude tokens for orchestration (~1-2k/task).

Anti-patterns

Anti-patternWhy it breaksDo this instead
Piping opencode run --format json straight into the orchestratorRaw NDJSON floods context — the exact cost the skill exists to avoidAlways go through scripts/oc-worker.mjs, which returns one compact JSON line
Two writing workers in one directoryConcurrent edits corrupt each other's diffsOne git worktree per writing worker, created before the spawn
Letting a worker merge, review, or approve its own branchFree-tier workers are the least reliable judges of their own outputThe orchestrator is the only merger and the only reviewer
Spawning workers sequentially, one per messageLoses the entire wall-clock benefit of a swarmIssue every worker invocation as parallel calls in ONE message
Retrying a failing worker indefinitelyBurns rate limit and stalls the taskRetry once, then do the subtask inline and mark it [orchestrator-sourced]
Delegating secrets, credentials, or private codeWorker traffic leaves for opencode's endpointsKeep sensitive context in the orchestrator; send workers only what is safe to share
Trusting cost_usd: 0 as a permanent guaranteeThe free tier belongs to opencode and can changeRe-check pricing before relying on zero cost for bulk work

Cross-references

  • engineering/llm-cost-optimizer — decide whether a task is worth delegating before Hivemind decides how
  • engineering/agent-harness — harness patterns for the orchestrator side of the loop
  • engineering/workflow-builder — for deterministic pipelines that do not need independent worker judgment
  • engineering/skills and engineering/write-a-skill — authoring conventions used by the worker agent definitions in assets/agents/
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

Browse all →
senior-architectSystem architecture decisions with a written rationale: monolith vs microservices, database choice, scaling limits, ADRs, Mermaid diagrams. Load whenever the user asks should we split, which database, will it scale, or wants an ADR.33 installsseo-auditFind why a site is not ranking: technical SEO, on-page issues, meta tags, site health. Use whenever the user asks why a page is not on Google, why traffic dropped or for an SEO audit.31 installsgrill-meInterview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to stress-test a plan, get grilled on their design, or mentions "grill me".23 installscode-reviewerUse for any code review: a pull request, a diff, a commit, or a pasted function, handler or file in TypeScript, JavaScript, Python, Go, Swift, Kotlin, C#/.NET, Java, C, C++, Rust, Ruby, PHP or Dart/Flutter. Applies per-language rule packs (security such as SQL injection and missing auth, async and resource handling, error handling, performance) and scripts that score a PR's risk and complexity, then gives a merge verdict with blocking and non-blocking findings. Use whenever the user asks to review, check or look over code, says 'code review', 'review this PR', 'review this diff' or 'is this safe to merge', or asks what is wrong with a snippet, even a single function.22 installscode-to-prdUse when asked to write a PRD or product spec from an existing codebase (reverse-engineer requirements, document pages, fields, routes and endpoints). Maps the code with codebase_analyzer.py and scaffolds the PRD with prd_scaffolder.py.21 installssenior-qaWrite and improve tests for React or Next.js apps: Jest, React Testing Library, MSW mocks, Playwright E2E, coverage gaps. Use whenever the user asks to add tests to a component or page, mock an API, set up end-to-end tests or raise coverage.17 installs

More from Multi-Domain Skills

View source →
senior-frontendBuild and review React, Next.js, TypeScript or Tailwind frontends: components, scaffolding, performance and bundle size. Use whenever the user wants a new component or app, a page feels slow, the bundle is too big, or asks for a frontend code review.631 installsui-design-systemUse when building a design system: tokens, component docs, responsive scales or developer handoff. Generates tokens with design_token_generator.py.530 installssenior-backendBuild and fix backend services: REST or GraphQL APIs, auth, microservices, PostgreSQL queries, migrations and load tests. Use whenever the user's API is slow or broken, needs login or auth added, a schema change, or a new endpoint or service scaffolded.244 installsself-improving-agentCurate what the agent has learned into durable project knowledge. Reviews Claude Code auto-memory (MEMORY.md and its topic files) for learnings worth keeping, promotes proven ones into CLAUDE.md or .claude/rules/, records a correction as a lesson that persists across sessions, prunes stale or duplicate entries, and turns a recurring fix into a reusable skill. Use whenever the user asks what you have learned or saved about the project, which memories should become permanent rules, to remember a lesson or stop repeating a mistake, or to clean up, audit or check memory health.172 installssocial-media-managerPlan social media: strategy, content calendar, community management, follower growth. Use whenever the user asks what to post and when, or how to grow followers. Single posts: social-content.136 installsmarketing-strategy-pmmUse for product positioning, ICP, competitive battlecards or a go-to-market plan, before drafting. Applies April Dunford's positioning method and produces the positioning statement, battlecards and launch plan.72 installs

More Build skills

Browse category →
frontend-designGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.341 installsusing-superpowersUse when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions144 installsweb-gameScaffolds a browser-based game with Phaser 3, PixiJS, or Three.js including game loop, asset pipeline, responsive canvas, input handling, audio, save/load, and deployment to itch.io or web. Triggers: on: "web game", "browser game", "html5 game", "phaser game", "pixi game".128 installsflutterBuilds Flutter applications from videos, screenshots, descriptions, or app clone requests. Triggers on: flutter app, build a mobile app, replicate this app in Flutter, build from video, build from screenshots, clone this app, build an app, make an app like, recreate this UI.124 installsreverse-engineer-anythingReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.107 installsgsap-pluginsOfficial GSAP skill for GSAP plugins — registration, ScrollToPlugin, ScrollSmoother, Flip, Draggable, Inertia, Observer, SplitText, ScrambleText, SVG and physics plugins, CustomEase, EasePack, CustomWiggle, CustomBounce, GSDevTools. Use when the user asks about a GSAP plugin, scroll-to, flip animations, draggable, SVG drawing, or plugin registration.85 installs

Frequently asked questions about hivemind

What does the hivemind skill do?

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. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the hivemind skill?

Run `npx @skills-hub-ai/cli install alirezarezvani-hivemind` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/alirezarezvani-hivemind/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does hivemind work with?

hivemind runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the hivemind skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use hivemind after installing it?

In Claude Code, type `/alirezarezvani-hivemind` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the hivemind skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.