| name | polybrain | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| description | Use when you need multi-model orchestration: decompose a high-level objective into subtasks, route each to a specialized model, run in parallel, synthesize, then verify. | ||||||||||||||
| version | 1.1.0 | ||||||||||||||
| author | Moses / LatticeAG | ||||||||||||||
| license | GPL-3.0 | ||||||||||||||
| metadata |
|
Multi-model orchestration for Hermes Agent. Decomposes an objective into subtasks, routes each to a specialized model, runs researchers/builders in parallel, synthesizes the results, then verifies against cited sources.
Inspired by the orchestration pattern behind Perplexity Computer — built as a local, config-driven, reproducible skill for any Hermes-compatible model.
- Objective requires research + analysis + writing (e.g., market briefs, reports).
- You want different models for different subtasks.
- You need citations and source verification.
- A single model can't handle the full workflow well.
- The user invokes the skill (via
/skill polybrain,hermes -s polybrain, or by attaching[IMPORTANT: The user has invoked the "polybrain" skill...]to a message).
Do NOT use when:
- A single model can handle it end-to-end.
- You need persistent state across sessions.
- You need hours-long autonomous workflows.
When the user invokes this skill, you MUST run the orchestration script via the terminal tool. Do NOT fall back to ad-hoc web_search / web_extract / other tool calls.
CRITICAL: Use background: true + notify_on_complete: true for the terminal call. The orchestrator runs multiple sequential LLM calls (orchestrator → researchers in parallel → synthesizer → verifier), which takes 4–10 minutes total. A foreground timeout: 300 will kill the entire process before researchers finish. Here is the correct invocation pattern:
terminal(
command='echo "<objective>" | python ~/.hermes/skills/research/polybrain/scripts/orchestrate.py',
background=True,
notify_on_complete=True
)Then periodically poll with process(action='poll') or wait for the notification. Do NOT use a foreground timeout — the orchestrator itself handles per-task timeouts internally via config.yaml.
For debugging (sequential, verbose logging):
terminal(
command='echo "<objective>" | python ~/.hermes/skills/research/polybrain/scripts/orchestrate_debug.py',
background=True,
notify_on_complete=True
)After completion, read the synthesis from the artifacts directory (~/.hermes/plans/polybrain/<run-id>/synthesis.md) or from stdout, and present it to the user.
Timeout notes:
- The orchestrator handles its own per-task timeouts via
config.yaml(timeout_sec: 600s per researcher,orchestrator_timeout_sec: 120s for orchestrator). - Total wall-clock time is approximately: orchestrator (~1 min) + max(researcher_1, researcher_2) (~5–10 min) + synthesizer (~2–3 min) ≈ 8–15 min.
- Using
background: trueavoids the agent's terminal timeout killing the process.
cp -r polybrain ~/.hermes/skills/research/hermes skills install https://github.com/<your-org>/polybrainEdit ~/.hermes/skills/research/polybrain/config.yaml:
models:
orchestrator: "your-model"
researcher: "your-model"
builder: "your-model"
synthesizer: "your-model"
verifier: "your-model"
fallback: "your-model"Then validate:
python ~/.hermes/skills/research/polybrain/scripts/validate_config.pyPolyBrain has two usage modes:
The user runs the orchestration script directly without the agent. It uses
hermes chat as a subprocess to call models.
echo "Create a market brief on Apple" | python ~/.hermes/skills/research/polybrain/scripts/orchestrate.pyOr interactively:
python ~/.hermes/skills/research/polybrain/scripts/orchestrate.py
# prompts: Objective: ...This is the primary usage mode. No agent interaction needed.
The skill's SKILL.md is loaded by Hermes Agent (via /skill polybrain or
hermes -s polybrain). The agent, reading the skill's instructions, may
invoke the orchestration script via the terminal tool when a user request
matches the skill's trigger conditions.
This mode requires:
- The skill directory copied to
~/.hermes/skills/research/. - A run like
hermes -s polybrainor/skill polybrainin-session. - The agent must then decide to spawn the script via terminal.
Note: Mode 2 is secondary. The core value is the standalone script.
Objective
├─ Orchestrator → JSON task list (schema enforced)
│
├─ Parallel ─┬─ Researcher 1 (web search + citations)
│ ├─ Researcher 2 (web search + citations)
│ └─ Builder (terminal/file ops)
│
├─ Synthesizer → unified brief (citations-only claims)
│
└─ Verifier → PASS/FAIL per claim + corrections
All outputs saved to settings.artifacts_dir/<run-id>/:
orchestrator.json— parsed task listtask_<id>.md— per-agent outputsynthesis.md— final deliverableverification.md— source verification report
| Role | Purpose | Toolsets |
|---|---|---|
| Orchestrator | Decompose objective, route tasks | none (text only) |
| Researcher | Web research with citations | web, browser |
| Builder | Code/tools, file ops | terminal, file |
| Synthesizer | Merge outputs into final deliverable | file |
| Verifier | Verify claims against sources | web |
- Researchers MUST use web tools and cite URLs.
- Synthesizer only uses cited claims — uncited claims are omitted.
- Verifier checks each claim against cited sources — INVALID if uncited or unsupported.
See config.yaml for all options. Key settings:
| Key | Default | Description |
|---|---|---|
models.* |
(required) | Model alias for each role |
providers.* |
(optional) | Provider override per role |
toolsets.* |
(optional) | Toolsets per role (informational) |
settings.max_parallel |
3 | Max parallel subagent tasks |
settings.timeout_sec |
600 | Per-task timeout (bumped from 300 — researchers need more time for web tool calls) |
settings.orchestrator_timeout_sec |
120 | Orchestrator-specific timeout |
settings.artifacts_dir |
.hermes/plans/polybrain |
Where run artifacts are saved |
- Missing model aliases — Run
validate_config.pybefore first use. - Model hangs/timeouts — Some models struggle with
hermes chatin subagent mode. Test withhermes chat -q "ping" -m your-modelfirst. - Orchestrator returns prose instead of JSON — Handled automatically (retry + JSON extraction).
- No citations in output — Check that researchers used web tools. See Debugging below.
- Verifier truncates numbers — Known issue with some models; results are still valid structurally.
- Iterative testing pattern — Test-as-you-build: validate config first, then run a small objective (e.g., 3 bullets), verify citations appear in output, then run the full workflow. Don't try to validate everything at once. Use
orchestrate_debug.pyfor verbose sequential logging,orchestrate.pyfor production. - Debug vs production runner —
orchestrate_debug.pyruns all tasks sequentially with full verbose logging (ideal for debugging).orchestrate.pyruns researchers/builders in parallel, then synthesis/verification sequentially (ideal for production). The prompts in both should be kept in sync. - Skill is Hermes-only — Uses
hermes chatas a subprocess. Not compatible with OpenClaw or other agents. For OpenClaw compatibility, a separate command wrapper would be needed. - Terminal foreground timeout kills the entire orchestration — The orchestrator takes 8–15 minutes total. If you run it as a foreground terminal command with
timeout: 300, the process is killed before any researcher finishes. ALWAYS usebackground: true+notify_on_complete: true. The orchestrator handles its own per-task timeouts internally viaconfig.yaml. This is the single most common failure mode when agents invoke the skill — the process appears to hang or timeout, but it's actually the agent's terminal timeout, not the orchestrator.
See references/pitfalls-terminal-timeout.md for the terminal timeout pitfall and correct invocation pattern.
To verify tool calls happened:
hermes sessions list
hermes sessions export /tmp/polybrain_sessions.jsonl
# Then inspect for "web_search", "web_extract" calls in the JSONLUse the debug runner for verbose output:
python scripts/orchestrate_debug.pyValidate config, then test with a simple objective. Use background: true for all runs:
python scripts/validate_config.pyThen run via terminal with background: true + notify_on_complete: true:
terminal(
command='echo "Summarize Apple\'s latest quarterly earnings in 3 bullets with sources" | python scripts/orchestrate.py',
background=True,
notify_on_complete=True
)