Backend dispatch
Skill firefly-events/plugin-hive/skills/hive/skills/backend-dispatch
Resolve the model-provider backend (Claude vs Codex) for an agent spawn and route to the correct dispatch surface. Inherits the caller's model and persona context.From its SKILL.md
npx -y skills add firefly-events/plugin-hive --skill backend-dispatchAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
5.0 KB, as published. Nobody here has run it
Hive Backend Dispatch
Atomic skill, NOT inline agent-spawn prose. Resolves which provider serves a given persona spawn and selects the dispatch surface (Messages-API substrate, tmux fallback, or codex-invoke). The caller still builds the spawn prompt and owns the surrounding procedure (respawn handling, episode reporting); this skill only owns the resolution + dispatch handoff.
Invocation contract
Call this skill after memory-loading returned prior_knowledge_block and the caller has assembled the full prompt structure, but BEFORE invoking the actual Agent/codex-invoke surface.
Inputs:
persona_context— output ofpersona-resolve(carriesagent_name,frontmatter.model).agent_backends—agent_backends.*map from roothive.config.yaml.backend_override— optional explicit override the caller passed in (highest precedence).prompt_parts— assembled{persona_text, domain_note, prior_knowledge_block, skills, continuation_context, task}parts. Some surfaces concatenate; cmux variants split across system + task files (seehive/references/agent-spawn-prompt-layout.mdfor the canonical split, owned by agent-spawn proper).caller_mode— caller's invocation context:team-executionorstandalone.pane_mode—one-shot(default) orpersistent(only relevant when resolved backend iscodex).existing_surface_id— only used whenpane_mode == persistent.
Outputs:
resolved_backendenumclaude | codex.dispatch_decision— record of the chosen surface:messages-api,tmux-fallback,codex-invoke-one-shot,codex-invoke-persistent-initial, orcodex-invoke-persistent-followup.dispatch_result— the report returned by whichever surface was invoked.
Side effects: episode record write (when backend is codex, log the backend for future cost/bias telemetry).
Process
Step 1: Resolve backend (model provider)
Decide whether this spawn runs through Claude (default) or an external model. Resolution order, first match wins:
- Explicit
backend_overridepassed in by the caller. agent_backends.{persona_context.agent_name}from roothive.config.yaml(consumer override layer; falls back tohive/hive.config.yaml). Matches the input-section contract at line 16.- Default:
claude.
Supported backends: claude | codex.
Step 2: Codex branch
If the resolved backend is codex:
- Record the backend in the episode record (for future cost/bias telemetry).
- Resolve
pane_modefrom the caller:one-shot(default) orpersistent.one-shot: open pane, send prompt, capture output, close pane (standard).persistent: two sub-modes depending on whetherexisting_surface_idis provided:- No surface_id (initial): open pane, start codex interactive, return
surface_idto caller. Do NOT send the task prompt or close the pane. - Surface_id provided (follow-up): send the prompt to the existing pane, poll for completion, capture output. Do NOT close the pane.
- No surface_id (initial): open pane, start codex interactive, return
- Build the full prompt structure from
prompt_partsexactly as the agent-spawn prompt-layout reference describes for one-shot mode and persistent follow-up mode. Skip prompt building for persistent initial mode because that call only opens the pane and returnssurface_id. - Do NOT call
Agentdirectly. Delegate to thecodex-invokeskill with the built prompt,pane_mode, and optionalexisting_surface_id. Return its report asdispatch_result. All subsequent steps in the caller (respawn continuation, episode reporting) still apply — codex-invoke is the dispatch surface, not a replacement for the surrounding procedure.
Step 3: Claude branch
If the resolved backend is claude, use this flow in order:
- Capability-check first: initialize the Claude client/session substrate needed for story-level dispatch. If the client cannot be initialized, treat that as a substrate capability miss rather than a story failure.
- Messages-API substrate by default: when the capability-check passes, route the spawn through
hive/lib/messages-session.js. This is the default Claude path for direct story-level dispatch because it keeps the spawn on the Messages-API loop instead of opening a tmux pane first. Returndispatch_decision=messages-api. - tmux fallback when client init fails: if the Messages-API client init fails, log the failure and fall back to the existing tmux
Agent(name:)path. Do not modify the prompt shape during fallback; only the transport changes. Returndispatch_decision=tmux-fallback.
Note: the cmux variant (visible split panes) is owned by agent-spawn §7.3 because it is a presentation-layer concern coupled to the orchestrator's pane lifecycle, not a backend choice. This skill returns Claude as the resolved backend and the caller decides cmux-vs-tmux via execution.terminal_mux.